Skip to content

Commit

Permalink
무한루프 오류 해결 (#185)
Browse files Browse the repository at this point in the history
* chore: cicd network

* chore: env file path

* chore: cd chroe

* fix: image prune

* fix: /t fix

* fix(#151): infinity loop fix
  • Loading branch information
mjh000526 authored Nov 29, 2024
1 parent c83e61b commit c34fa23
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
13 changes: 6 additions & 7 deletions apps/backend/src/docker/docker.consumer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ export class DockerConsumer {
await this.dockerContainerPool.returnContainer(container);
}
}

async runGistFiles(
container: Container,
gitToken: string,
Expand All @@ -68,19 +67,19 @@ export class DockerConsumer {
}
const stream = await this.dockerExcution(inputs, mainFileName, container);
let output = '';

setTimeout(async () => {
stream.end();
const timeout = setTimeout(async () => {
console.log('timeout');
stream.destroy(new Error('Timeout'));
}, 5000);
//desciption: 스트림 종료 후 결과 반환
return new Promise((resolve, reject) => {
//desciption: 스트림에서 데이터 수집
stream.on('data', (chunk) => {
output += chunk.toString();
});

stream.on('end', async () => {
let result = this.filterAnsiCode(output);
stream.on('close', async () => {
let result = await this.filterAnsiCode(output);
clearTimeout(timeout);
if (inputs.length !== 0) {
result = result.split('\n').slice(1).join('\n');
}
Expand Down
1 change: 1 addition & 0 deletions apps/backend/src/history/history.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export class HistoryService {
const result = await this.dockerProducer.getDocker(gitToken, lotusId, commitId, execFilename, inputs);
await this.historyRepository.update(historyId, { status: HISTORY_STATUS.SUCCESS, result });
} catch (error) {
console.log(error.message);
await this.historyRepository.update(historyId, {
status: HISTORY_STATUS.ERROR,
result: error.message
Expand Down

0 comments on commit c34fa23

Please sign in to comment.