Accidentally responded off list. On Tue, Jun 9, 2020 at 1:06 PM Андрей <heckad@yandex.ru> wrote:
Thank you for your comment.
This feature is very needed for https://github.com/mosquito/aio-pika/pull/327.
PS How to send response on this message? I don’t see this message on *mail.python.org <http://mail.python.org>. *
You need to register on python's bug tracker if you want to be able to respond to the bug report there.
And where do you find RLock?
It's in the threading package <https://docs.python.org/3.9/library/threading.html#threading.RLock>. You can use a normal Lock, it's just that I needed to be able to call this from __del__ <https://docs.python.org/3/reference/datamodel.html#object.__del__> so I needed a lock that can be re-entered.
Отправлено из приложения "Почта <https://go.microsoft.com/fwlink/?LinkId=550986>" для Windows 10
*От: *Matthew Einhorn <moiein2000@gmail.com> *Отправлено: *9 июня 2020 г. в 19:41 *Кому: *Kazantcev Andrey <heckad@yandex.ru> *Тема: *Re: [Python-ideas] Add close method to queue
I was just looking for something similar, but this was already requested and rejected for lack of use cases here: https://bugs.python.org/issue29701.
For my own use case, a RLock with a class variable indicating the queue was closed did the trick.
On Tue, Jun 9, 2020 at 8:25 AM Kazantcev Andrey <heckad@yandex.ru> wrote:
I have a problem with notifying all current subscribers and new subscribers about the closure of the queue and the reason. For example, I have a producer that reads messages from websocket or something else and send this to a queue, and several consumers (I do not know how many). If any exception occurred, then all current subscribers and subscribers which will be added later should know about this error. I tried to send an exception to a queue, but that did not help, because I have several consumers. Also, this will not protect new consumers. I propose to add a new close method with exc argument, which will throw an exception when calling the get method, and also throw an exception for all current _getters. _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-leave@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/EYVGOE... Code of Conduct: http://python.org/psf/codeofconduct/
participants (1)
-
Matthew Einhorn