async-queue-runner 0.17.0 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_cjs/queue.js +4 -3
- package/_esm/queue.js +4 -3
- package/package.json +1 -1
package/_cjs/queue.js
CHANGED
|
@@ -49,14 +49,18 @@ class AsyncQueue {
|
|
|
49
49
|
}
|
|
50
50
|
const item = this.queue.shift();
|
|
51
51
|
const action = this.processQueueItem(item);
|
|
52
|
+
const actionName = action.constructor.name || 'some undefined';
|
|
53
|
+
this.logger.setContext(actionName);
|
|
52
54
|
const isLocking = action.locking;
|
|
53
55
|
const scope = action.scope;
|
|
54
56
|
if (isLocking) {
|
|
55
57
|
if (this.locker.isLocked(scope)) {
|
|
58
|
+
this.logger.info(`Queue(${this.name}): waiting for scope to unlock`);
|
|
56
59
|
await this.locker.wait(scope);
|
|
57
60
|
}
|
|
58
61
|
this.locker.lock(scope);
|
|
59
62
|
}
|
|
63
|
+
this.logger.info(`Queue(${this.name}): running action`);
|
|
60
64
|
await this.iterate(action);
|
|
61
65
|
if (isLocking) {
|
|
62
66
|
this.locker.unlock(scope);
|
|
@@ -70,9 +74,6 @@ class AsyncQueue {
|
|
|
70
74
|
}
|
|
71
75
|
}
|
|
72
76
|
async iterate(action) {
|
|
73
|
-
const actionName = action.constructor.name || 'some undefined';
|
|
74
|
-
this.logger.setContext(actionName);
|
|
75
|
-
this.logger.info(`Queue(${this.name}): running action`);
|
|
76
77
|
await action.execute(this.context);
|
|
77
78
|
await this.delay(action.delay);
|
|
78
79
|
}
|
package/_esm/queue.js
CHANGED
|
@@ -46,14 +46,18 @@ export class AsyncQueue {
|
|
|
46
46
|
}
|
|
47
47
|
const item = this.queue.shift();
|
|
48
48
|
const action = this.processQueueItem(item);
|
|
49
|
+
const actionName = action.constructor.name || 'some undefined';
|
|
50
|
+
this.logger.setContext(actionName);
|
|
49
51
|
const isLocking = action.locking;
|
|
50
52
|
const scope = action.scope;
|
|
51
53
|
if (isLocking) {
|
|
52
54
|
if (this.locker.isLocked(scope)) {
|
|
55
|
+
this.logger.info(`Queue(${this.name}): waiting for scope to unlock`);
|
|
53
56
|
await this.locker.wait(scope);
|
|
54
57
|
}
|
|
55
58
|
this.locker.lock(scope);
|
|
56
59
|
}
|
|
60
|
+
this.logger.info(`Queue(${this.name}): running action`);
|
|
57
61
|
await this.iterate(action);
|
|
58
62
|
if (isLocking) {
|
|
59
63
|
this.locker.unlock(scope);
|
|
@@ -67,9 +71,6 @@ export class AsyncQueue {
|
|
|
67
71
|
}
|
|
68
72
|
}
|
|
69
73
|
async iterate(action) {
|
|
70
|
-
const actionName = action.constructor.name || 'some undefined';
|
|
71
|
-
this.logger.setContext(actionName);
|
|
72
|
-
this.logger.info(`Queue(${this.name}): running action`);
|
|
73
74
|
await action.execute(this.context);
|
|
74
75
|
await this.delay(action.delay);
|
|
75
76
|
}
|