Skip to content

Commit

Permalink
fix: distinct processing task (#406)
Browse files Browse the repository at this point in the history
> 相同任务并发执行时,如果上游有 changesStream 事件,可能会导致版本被错误删除。
* 撤销 #352 的变更,我们已在
#361 中解决了事件实时性问题

------------

> Concurrent execution of the same task with changesStream events may
cause versions to be deleted incorrectly.
* revert #352, since we have fixed
in #361
  • Loading branch information
elrrrrrrr authored Feb 14, 2023
1 parent 97ca612 commit c43c067
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/core/service/TaskService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ export class TaskService extends AbstractService {
task.type, task.targetName, task.taskId, queueLength);
}
}
return existsTask;
}
return existsTask;
}
await this.taskRepository.saveTask(task);
await this.queueAdapter.push<string>(task.type, task.taskId);
Expand Down
4 changes: 2 additions & 2 deletions test/core/service/PackageSyncerService/createTask.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ describe('test/core/service/PackageSyncerService/createTask.test.ts', () => {
assert(task);
});

it('should create task when processing', async () => {
it('should merge task when processing', async () => {
mock(packageSyncerService, 'executeTask', async (task: Task) => {
task.state = TaskState.Processing;
await taskRepository.saveTask(task);
Expand All @@ -71,7 +71,7 @@ describe('test/core/service/PackageSyncerService/createTask.test.ts', () => {
await setTimeout(1);
return await packageSyncerService.createTask(pkgName);
})() ]);
assert(res[1].taskId !== task.taskId);
assert(res[1].taskId === task.taskId);
});

it('should not duplicate task when waiting', async () => {
Expand Down

0 comments on commit c43c067

Please sign in to comment.