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
Improve worker pool scaling logic and update README
- Update the worker pool scaling logic to consider the size of the workerStack and the length of the taskQueue.
- Adjust the scaling logic to double the workerStack when the taskQueue length exceeds 75% of the workerStack size, but not exceeding maxWorkers.
- Adjust the scaling logic to halve the workerStack when the taskQueue is empty, but not less than minWorkers.
- Update the README to reflect these changes and improve the feature list format.
- Add comments to the code for better readability.
Signed-off-by: Daniel Hu <[email protected]>
Copy file name to clipboardExpand all lines: README.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,25 +6,25 @@ GoPool is a high-performance, feature-rich, and easy-to-use worker pool library
6
6
7
7
## Features
8
8
9
-
-**Task Queue**: GoPool uses a thread-safe task queue to store tasks waiting to be processed. Multiple workers can simultaneously fetch tasks from this queue.
9
+
-[x]**Task Queue**: GoPool uses a thread-safe task queue to store tasks waiting to be processed. Multiple workers can simultaneously fetch tasks from this queue.
10
10
11
-
-**Dynamic Worker Adjustment**: GoPool can dynamically adjust the number of workers based on the number of tasks and system load.
11
+
-[x]**Concurrency Control**: GoPool can control the number of concurrent tasks to prevent system overload.
12
12
13
-
-**Graceful Shutdown**: GoPool can shut down gracefully. It stops accepting new tasks and waits for all ongoing tasks to complete before shutting down when there are no more tasks or a shutdown signal is received.
13
+
-[x]**Dynamic Worker Adjustment**: GoPool can dynamically adjust the number of workers based on the number of tasks and system load.
14
14
15
-
-**Task Error Handling**: GoPool can handle errors that occur during task execution.
15
+
-[x]**Graceful Shutdown**: GoPool can shut down gracefully. It stops accepting new tasks and waits for all ongoing tasks to complete before shutting down when there are no more tasks or a shutdown signal is received.
16
16
17
-
-**Task Timeout Handling**: GoPool can handle task execution timeouts. If a task is not completed within the specified timeout period, the task is considered failed and a timeout error is returned.
17
+
-[x]**Task Error Handling**: GoPool can handle errors that occur during task execution.
18
18
19
-
-**Task Priority**: GoPool supports task priority. Tasks with higher priority are processed first.
19
+
-[x]**Task Timeout Handling**: GoPool can handle task execution timeouts. If a task is not completed within the specified timeout period, the task is considered failed and a timeout error is returned.
20
20
21
-
-**Task Result Retrieval**: GoPool provides a way to retrieve task results.
21
+
-[x]**Task Result Retrieval**: GoPool provides a way to retrieve task results.
22
22
23
-
-**Task Retry**: GoPool provides a retry mechanism for failed tasks.
23
+
-[x]**Task Retry**: GoPool provides a retry mechanism for failed tasks.
24
24
25
-
-**Concurrency Control**: GoPool can control the number of concurrent tasks to prevent system overload.
25
+
-[x]**Lock Customization**: GoPool supports different types of locks. You can use the built-in `sync.Mutex` or a custom lock such as `spinlock.SpinLock`.
26
26
27
-
-**Lock Customization**: GoPool supports different types of locks. You can use the built-in `sync.Mutex` or a custom lock such as `spinlock.SpinLock`.
27
+
-[ ]**Task Priority**: GoPool supports task priority. Tasks with higher priority are processed first.
0 commit comments