Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor worker pool for better scalability and readability
- Split `executeTask` function into `executeTaskWithTimeout` and `executeTaskWithoutTimeout` for better readability. - Move worker pool scaling logic into a separate goroutine that runs periodically, improving scalability and making the `dispatch` function simpler. - Add `retryCount` and `adjustInterval` fields to the `goPool` struct to support task retry and adjustable worker scaling intervals. - Update tests and README to reflect these changes. Signed-off-by: Daniel Hu <tao.hu@merico.dev>
- Loading branch information
1 parent
5a7dd13
commit 4974182
Showing
5 changed files
with
107 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters