Skip to content

Limit SinkAsync coro queue #52

@phettberg

Description

@phettberg

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.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions