Async::Task#stop vs. stop messages? #217
Unanswered
postmodern
asked this question in
Q&A
Replies: 1 comment 2 replies
-
Stopping a task is not graceful, so I suggest you do both. How you design the "shutdown" part of your program should depend on whether interrupting jobs is acceptable. Normally, using a timer to ensure all work is completed, is reasonable. Closing the work queues, followed by a timeout around a join operation, finally termination, is a good strategy. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello, I'm building a unique producer/consumer messaging/job queue using the Async gem, and was wondering what are the pros/cons of calling
Async::Task#stop
on the main async task to shutdown all workers once all work has been completed vs. sending in a bunch ofstop
messages into the job queue to get the workers to gracefully exit their consumer loops one-by-one? Is one style preferred over the other with regards to how Async is designed? Do I run the risk of causing deadlocks or exceptions if I callAsync::Task#stop
?Beta Was this translation helpful? Give feedback.
All reactions