You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Would like to make a feature request for the Queue class: the ability to throw errors to all greenlets that may be waiting on a Queue.put() or Queue.get() on that queue and to any future calls to those two APIs on that particular Queue instance.
The use case is a Queue might be part of a more complicated structure of gevent resources stitched together to accomplish a task. If an error occurs (say a greenlet dies or a resource like a serial port closes), the simplest way to recover is to just tear it all down and rebuild it again. For that to happen cleanly without leaking resources, we need a way to cause all current greenlets waiting on get()s or put()s and any future calls to those methods to return an error.
The workaround I'm using at the moment is using getcurrent() to track every greenlet that is entering a potentially blocking Queue.get() or Queue.put() call and then iterating over that list and kill()ing them.
The text was updated successfully, but these errors were encountered:
Would like to make a feature request for the Queue class: the ability to throw errors to all greenlets that may be waiting on a Queue.put() or Queue.get() on that queue and to any future calls to those two APIs on that particular Queue instance.
The use case is a Queue might be part of a more complicated structure of gevent resources stitched together to accomplish a task. If an error occurs (say a greenlet dies or a resource like a serial port closes), the simplest way to recover is to just tear it all down and rebuild it again. For that to happen cleanly without leaking resources, we need a way to cause all current greenlets waiting on get()s or put()s and any future calls to those methods to return an error.
The workaround I'm using at the moment is using getcurrent() to track every greenlet that is entering a potentially blocking Queue.get() or Queue.put() call and then iterating over that list and kill()ing them.
The text was updated successfully, but these errors were encountered: