Skip to content

Commit

Permalink
chore: log waiting did jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
JGiter committed Aug 3, 2023
1 parent 85f003e commit 413382f
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 3 deletions.
17 changes: 17 additions & 0 deletions docs/api/classes/modules_did_did_processor.DIDProcessor.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

### Methods

- [OnQueueWaiting](modules_did_did_processor.DIDProcessor.md#onqueuewaiting)
- [onActive](modules_did_did_processor.DIDProcessor.md#onactive)
- [onError](modules_did_did_processor.DIDProcessor.md#onerror)
- [onFailed](modules_did_did_processor.DIDProcessor.md#onfailed)
Expand All @@ -35,6 +36,22 @@

## Methods

### OnQueueWaiting

**OnQueueWaiting**(`job`): `Promise`<`void`\>

#### Parameters

| Name | Type |
| :------ | :------ |
| `job` | `Job`<`any`\> |

#### Returns

`Promise`<`void`\>

___

### onActive

**onActive**(`job`): `void`
Expand Down
24 changes: 21 additions & 3 deletions docs/api/classes/modules_ipfs_pin_processor.PinProcessor.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

### Methods

- [OnQueueWaiting](modules_ipfs_pin_processor.PinProcessor.md#onqueuewaiting)
- [onError](modules_ipfs_pin_processor.PinProcessor.md#onerror)
- [onFailed](modules_ipfs_pin_processor.PinProcessor.md#onfailed)
- [onStalled](modules_ipfs_pin_processor.PinProcessor.md#onstalled)
Expand All @@ -19,7 +20,7 @@

### constructor

**new PinProcessor**(`logger`, `didStoreCluster`, `didStoreInfura`)
**new PinProcessor**(`logger`, `didStoreCluster`, `didStoreInfura`, `pinQueue`)

#### Parameters

Expand All @@ -28,12 +29,29 @@
| `logger` | [`Logger`](modules_logger_logger_service.Logger.md) |
| `didStoreCluster` | `DidStore` |
| `didStoreInfura` | `DidStore` |
| `pinQueue` | `Queue`<`any`\> |

## Methods

### OnQueueWaiting

**OnQueueWaiting**(`job`): `Promise`<`void`\>

#### Parameters

| Name | Type |
| :------ | :------ |
| `job` | `Job`<`any`\> |

#### Returns

`Promise`<`void`\>

___

### onError

**onError**(`error`): `void`
**onError**(`error`): `Promise`<`void`\>

#### Parameters

Expand All @@ -43,7 +61,7 @@

#### Returns

`void`
`Promise`<`void`\>

___

Expand Down
9 changes: 9 additions & 0 deletions src/modules/did/did.processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
OnQueueError,
OnQueueFailed,
OnQueueStalled,
OnQueueWaiting,
Process,
Processor,
} from '@nestjs/bull';
Expand Down Expand Up @@ -61,6 +62,14 @@ export class DIDProcessor {
this.logger.debug(`Failed ${job.name} document ${job.data}`);
}

@OnQueueWaiting()
async OnQueueWaiting(job: Job) {
this.logger.debug(`Waiting ${job.name} document ${job.data}`);
this.logger.debug(
`Total number of waiting jobs ${await this.didQueue.count()}`
);
}

@Process(ADD_DID_DOC_JOB_NAME)
public async processDIDDocumentAddition(job: Job<string>) {
const doc = await this.didService.addCachedDocument(job.data);
Expand Down

0 comments on commit 413382f

Please sign in to comment.