Skip to content
This repository was archived by the owner on Aug 7, 2023. It is now read-only.

Commit 4373221

Browse files
Pass along log messages from the worker…
…and skip `handleError` if the job already appears to have been handled.
1 parent ade12f0 commit 4373221

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lib/job-manager.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,10 @@ class JobManager {
102102
}
103103

104104
receiveMessage (data) {
105-
console.debug('receiveMessage:', data);
105+
if (data.log) {
106+
console.log('WORKER LOG:', data.log);
107+
return;
108+
}
106109
let key = data.key;
107110
if (!key) {
108111
throw new Error(`Received message from worker without key`);
@@ -122,6 +125,10 @@ class JobManager {
122125
// just throw an error and let it get handled elsewhere.
123126
receiveError (data) {
124127
if (typeof data === 'object' && data.key) {
128+
if (!this.handlersForJobs.has(data.key)) {
129+
// Assume this has already been handled and silently fail.
130+
return;
131+
}
125132
let [, reject] = this.handlersForJobs.get(data.key);
126133
this.handlersForJobs.delete(data.key);
127134
reject(data);

0 commit comments

Comments
 (0)