diff --git a/app/core/service/TaskService.ts b/app/core/service/TaskService.ts index 2082ee6f..94f7152f 100644 --- a/app/core/service/TaskService.ts +++ b/app/core/service/TaskService.ts @@ -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(task.type, task.taskId); diff --git a/test/core/service/PackageSyncerService/createTask.test.ts b/test/core/service/PackageSyncerService/createTask.test.ts index 4fae6b89..ef6afab5 100644 --- a/test/core/service/PackageSyncerService/createTask.test.ts +++ b/test/core/service/PackageSyncerService/createTask.test.ts @@ -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); @@ -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 () => {