Skip to content

Commit

Permalink
fix: ignore hook when disable (#702)
Browse files Browse the repository at this point in the history
> Currently, `triggerHookWorkerMaxConcurrentTasks` is 10 by defualt,
which can lead to some redis queries even hookEnable is not activated.
* ♻️ Follow `CreateTriggerHookWorker`, when hookEnable is not activated,
do not query task queue.
-------

> 目前 triggerHookWorkerMaxConcurrentTasks 默认为 10,在未开启 hookEnable
时会带来一些冗余的 redis 查询
* ♻️ 参照 `CreateTriggerHookWorker` 逻辑,hookEnable 关闭时,不进行存量任务轮训

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Bug Fixes**
- Added a check to ensure hooks are enabled before proceeding, improving
reliability and preventing errors when hooks are disabled.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • Loading branch information
elrrrrrrr committed Jul 11, 2024
1 parent 381a10c commit bd49917
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions app/port/schedule/TriggerHookWorker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export class TriggerHookWorker {
private readonly taskService: TaskService;

async subscribe() {
if (!this.config.cnpmcore.hookEnable) return;
if (executingCount >= this.config.cnpmcore.triggerHookWorkerMaxConcurrentTasks) return;

executingCount++;
Expand Down

0 comments on commit bd49917

Please sign in to comment.