When creating a SinkAsync object, using the mode op.AsyncMode.QUEUE , this coro queue could basically grow limitlessly. In case the queue is filled up too fast due to a missed edge case and/or limited system resources (e.g., embedded), this could kill the application.
To handle this, I suggest introducing an optional, additional parameter max_queue_threshold to the SinkAsync class. As the name suggests, this is a "threshold" rather than an absolute limit, which would kind of defeat the purpose of the queue mode. In case the length of the CoroQueue exceeds max_queue_threshold , CoroQueue shall emit a RuntimeError. It is the developers' responsibility to
- define a reasonable threshold for their application, which is not too sharp but also keeps the application running safely.
- handle the runtime error. Either use the
default_error_handler and deliberately throw a system error or use error_callback of the SinkAsync class for custom handling.
When creating a
SinkAsyncobject, using the modeop.AsyncMode.QUEUE, this coro queue could basically grow limitlessly. In case the queue is filled up too fast due to a missed edge case and/or limited system resources (e.g., embedded), this could kill the application.To handle this, I suggest introducing an optional, additional parameter
max_queue_thresholdto theSinkAsyncclass. As the name suggests, this is a "threshold" rather than an absolute limit, which would kind of defeat the purpose of the queue mode. In case the length of theCoroQueueexceedsmax_queue_threshold,CoroQueueshall emit aRuntimeError. It is the developers' responsibility todefault_error_handlerand deliberately throw a system error or useerror_callbackof theSinkAsyncclass for custom handling.