-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using task_done() in multiple threads #89
Comments
@kodonnell this is known limitation for file queue. In my opinion,you should reenque the failed items so that it can be processed later, can this fit your case |
Sorry, I wasn't aware. Can this be documented? It's described as "thread-safe" and this doesn't really fit that bill. Also - doesn't the same apply to the sqlite queue? (I assume that's what the
Ah - so you mean every time I |
@kodonnell sqlite ack queue should fit well in your case since you have strict FIFO requirement, I strongly suggest you trying it. the file queue data is written sequentially, and it's hard to implement ACK for part of its content. If you have any idea, just pop it up here. Thanks |
Late here but use multiple similar queue having dedicated roles (i.e. not just 1 but 2 additional compensating queues, so 1 queue for success and 2 queues for handling failure scenarios); accordingly put items so that you can jump / swap between them. That should ensure FIFO with some additional load. |
I'd like to use
Queue
to store items to be processed by threads. However, if one of the items fails to get processed (andtask_done
is hence not called) it's still possible that the item is removed from the queue persistently (whereas one would expect it not to be, as is usual behaviour).Example:
Output:
As you can see,
'a'
was permanently removed, even thoughtask_done
"wasn't" called. In other words, I'd expect to seeqsize 1
as the output. Is there a way to achieve this, i.e.task_done
only completes a specific task, not all tasks in all threads?Bonus question: how do I also add
'a'
back onto the in-memory queue (ignoring persistence)? I.e. the equivalent ofSQLiteAckQueue.nack
? The only way I see how would be reloading the queue from disk (in which case theget
wouldn't have persisted) but this seems messy.(Also, yes, I know of the
SQLiteAckQueue
which seems well-suited, but I'd prefer to use plain files if possible.)The text was updated successfully, but these errors were encountered: