Skip to content

Commit

Permalink
fix(#151): log
Browse files Browse the repository at this point in the history
  • Loading branch information
mjh000526 committed Dec 3, 2024
1 parent f5bf125 commit c20d54c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
7 changes: 4 additions & 3 deletions apps/backend/src/docker/docker.consumer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,19 @@ export class DockerConsumer {
}
}

@Process({ name: 'always-docker-run', concurrency: 5 })
@Process({ name: 'always-docker-run', concurrency: 3 })
async alwaysDockerRun(job: Job) {
const { gitToken, gistId, commitId, mainFileName, inputs, c } = job.data;
let container;
try {
console.log(`${c}번째 프로세스 시작`);
container = await this.dockerContainerPool.getContainer();
console.log(`컨테이너 할당: ${container.id}`);
const containerInfo = await container.inspect();
console.log(`${c}번째 작업 컨테이너 할당: ${containerInfo.Name}`);
const result = await this.runGistFiles(container, gitToken, gistId, commitId, mainFileName, inputs);
await this.cleanWorkDir(container);
this.dockerContainerPool.pool.push(container);
console.log(`컨테이너 반납: ${container.id}`);
console.log(`${c}번째 작업 컨테이너 반납: ${containerInfo.Name}`);
console.log(`${c}번째 프로세스 종료`);
return result;
} catch (error) {
Expand Down
1 change: 1 addition & 0 deletions apps/backend/src/docker/docker.pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export class DockerContainerPool implements OnApplicationBootstrap {
}
});
container.start();

this.pool.push(container);
}
}
Expand Down

0 comments on commit c20d54c

Please sign in to comment.