Skip to content

Commit

Permalink
Revert "Revert "fix: remove save many from queue service[3966]""
Browse files Browse the repository at this point in the history
This reverts commit 998dbe7.
  • Loading branch information
IharTsykala committed Sep 20, 2024
1 parent 3a53696 commit e2c2044
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions queue-service/src/queue-service/queue-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ export class QueueService extends NatsService{

const dataBaseServer = new DatabaseServer();

const taskObjects = []
// const taskObjects = []

for (const worker of workers) {
const task = await dataBaseServer.findOne(TaskEntity, {
Expand All @@ -190,14 +190,15 @@ export class QueueService extends NatsService{
if (r?.result) {
task.processedTime = new Date();
task.sent = true;
await dataBaseServer.save(TaskEntity, task);

taskObjects.push(task);
// taskObjects.push(task);
} else {
console.log('task sent error')
}
}

await dataBaseServer.saveMany(TaskEntity, taskObjects);
// await dataBaseServer.saveMany(TaskEntity, taskObjects);
}

private async clearOldTasks() {
Expand All @@ -221,7 +222,7 @@ export class QueueService extends NatsService{
task.sent = false;
}

await dataBaseServer.saveMany(TaskEntity, tasks);
await dataBaseServer.save(TaskEntity, tasks);
}

/**
Expand Down

0 comments on commit e2c2044

Please sign in to comment.