diff --git a/docs/api/classes/modules_did_did_processor.DIDProcessor.md b/docs/api/classes/modules_did_did_processor.DIDProcessor.md index 6ee162cd..79ac460f 100644 --- a/docs/api/classes/modules_did_did_processor.DIDProcessor.md +++ b/docs/api/classes/modules_did_did_processor.DIDProcessor.md @@ -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) @@ -35,6 +36,22 @@ ## Methods +### OnQueueWaiting + +▸ **OnQueueWaiting**(`job`): `Promise`<`void`\> + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `job` | `Job`<`any`\> | + +#### Returns + +`Promise`<`void`\> + +___ + ### onActive ▸ **onActive**(`job`): `void` diff --git a/docs/api/classes/modules_ipfs_pin_processor.PinProcessor.md b/docs/api/classes/modules_ipfs_pin_processor.PinProcessor.md index 08d85d6c..65bcffe0 100644 --- a/docs/api/classes/modules_ipfs_pin_processor.PinProcessor.md +++ b/docs/api/classes/modules_ipfs_pin_processor.PinProcessor.md @@ -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) @@ -19,7 +20,7 @@ ### constructor -• **new PinProcessor**(`logger`, `didStoreCluster`, `didStoreInfura`) +• **new PinProcessor**(`logger`, `didStoreCluster`, `didStoreInfura`, `pinQueue`) #### Parameters @@ -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 @@ -43,7 +61,7 @@ #### Returns -`void` +`Promise`<`void`\> ___ diff --git a/src/modules/did/did.processor.ts b/src/modules/did/did.processor.ts index 799ea68a..d94c67b0 100644 --- a/src/modules/did/did.processor.ts +++ b/src/modules/did/did.processor.ts @@ -4,6 +4,7 @@ import { OnQueueError, OnQueueFailed, OnQueueStalled, + OnQueueWaiting, Process, Processor, } from '@nestjs/bull'; @@ -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) { const doc = await this.didService.addCachedDocument(job.data);