Portal: https://github.com/vearne/executor

This project is inspired by Java Executors and references the interface design of ExecutorService.   Supports canceling a single task, or canceling a task for an entire cluster. It also provides an implementation DynamicGPool that can dynamically scale up and down.  Here’s a more detailed description:

Cancellation of individual tasks is supported, or all tasks on a coroutine pool can be canceled

You can also use context. Context cancels the task or pool.

You can create several different types of coroutine pools (SingleGPool| FixedGPool| DynamicGPool)

When submitting a task, if the task queue is full, try adding workers to execute the task.

Condition: If the number of workers in the busy state is less than 1/4 of the total number of workers, the condition is considered to be met

Perform meetCondNum consecutive detections, each time detectInterval. If the condition is met each time, the scale-in is triggered.

The shrink action attempts to cut the number of workers in half

Because executor uses channel as a task queue, blocking can occur when submitting a task.

If the coroutine pool is executing in the background for a long time, we strongly recommend monitoring the usage of task queues.

More examples

Set the log level optional value: debug | info | warn | error