Skip to content

Commit

Permalink
Fix job cleaner (#31)
Browse files Browse the repository at this point in the history
* fix bug in job-cleaner

* bump version to 1.1.1

* remove console.log
  • Loading branch information
EverettSummer authored Jan 15, 2023
1 parent 6c52468 commit 5971ac7
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mira-video-manager",
"version": "1.1.0",
"version": "1.1.1",
"description": "Video Process for mira project",
"main": "index.js",
"scripts": {
Expand Down
3 changes: 2 additions & 1 deletion src/JobManager/JobCleaner.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2022 IROHA LAB
* Copyright 2023 IROHA LAB
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -43,6 +43,7 @@ export class JobCleaner {

public async start(jobExecutorId: string): Promise<void> {
this._jobExecutorId = jobExecutorId;
await this.doCheckJobs(JobStatus.UnrecoverableError);
this.checkCanceledJobs();
this.checkCompleteJobs();
this.checkErrorJobs();
Expand Down
4 changes: 2 additions & 2 deletions src/repository/JobRepository.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2022 IROHA LAB
* Copyright 2023 IROHA LAB
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -23,7 +23,7 @@ export class JobRepository extends BaseEntityRepository<Job> {
const latestStartTime = new Date(Date.now() - expire);
return await this.find({
$and: [
{status: JobStatus.Finished},
{status},
{cleaned: false},
{startTime: {$lt: latestStartTime}}
]
Expand Down
4 changes: 2 additions & 2 deletions src/services/FileManageService.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2022 IROHA LAB
* Copyright 2023 IROHA LAB
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -103,7 +103,7 @@ export class FileManageService {
try {
const files = await readdir(tempDir);
for (const file of files) {
await unlink(file);
await unlink(join(tempDir, file));
}
} catch (err) {
this._sentry.capture(err);
Expand Down

0 comments on commit 5971ac7

Please sign in to comment.