Open adbalits opened 3 years ago
I have done some investigation. The reason the job triggers the onFailed
lifecycle event is because this error gets triggered during execution of the job:
TypeError: Cannot read property 'ok' of undefined
at Queue._callee5$ (Queue.js:329)
at tryCatch (runtime.js:63)
at Generator.invoke [as _invoke] (runtime.js:294)
at Generator.next (runtime.js:119)
at fulfilled (Queue.js:10)
at tryCallOne (core.js:37)
at core.js:123
at JSTimers.js:270
at _callTimer (JSTimers.js:123)
at _callImmediatesPass (JSTimers.js:177)
Still looking into why that happens.
Update: it was this line in the processJob
function of Queue.js
that caused the runtime error which led to the onFailed
event...
if (!executionResult.ok) throw new Error('Execution failure'); // here we catch http errors
I modified my job handler to do the following:
const handleJob = async (id, payload) => {
console.log(`QueueService::${jobName}Worker::ENTER`, {id, payload});
// do nothing for now
console.log(`QueueService::${jobName}Worker::EXIT`, {id, payload});
return {ok:true};
};
And now the onSuccess
lifecycle event gets triggered instead of onFailed
.
I will leave the issue open because this should really be explained in the README.
Hello, great library, but I've been working on getting an example running inside my App.tsx and I've noticed that for some reason my "exampleJob" will always end with the
onFailed
event rather thanonSuccess
.Here's the code...
And here's the output...
I've tried to figure out what leads to onFailed vs onSuccess but I haven't had any luck. Appreciate any advice.