Hello,
When a task takes longer than is allowed by maxTimeout the task is deleted from the store by calling store.releaseLock. The the task is re-added to the store to be processed again, assuming maxRetries has not been exhausted. This creates an issue where if the application is killed at just the right time the task is completely lost.
Is there a way to avoid this? Am I just using this library wrong? Thanks.
const Queue = require('better-queue')
const task = (input ,callback) => {}
const queue = new Queue(
task,
{
store: {
type: 'sql',
dialect: 'sqlite',
path: './task-store.sqll'
},
maxRetries: Infinity,
retryDelay: 0,
maxTimeout: 1000
}
)
queue.push({id: Math.random() , name:'foo'})
queue.on('drain', () => process.exit())
In the above example once the task is removed due to timeout, but before it is re-queued, the drain event fires and the app is exited, this simulates the app getting killed at a really bad time. The task will no longer be present in sqlite data store.
Hello,
When a task takes longer than is allowed by maxTimeout the task is deleted from the store by calling store.releaseLock. The the task is re-added to the store to be processed again, assuming maxRetries has not been exhausted. This creates an issue where if the application is killed at just the right time the task is completely lost.
Is there a way to avoid this? Am I just using this library wrong? Thanks.
In the above example once the task is removed due to timeout, but before it is re-queued, the drain event fires and the app is exited, this simulates the app getting killed at a really bad time. The task will no longer be present in sqlite data store.