const app = new Application();
app.use(async (context) => {
console.log(`Request started at: ${new Date().toISOString()}`);
await new Promise((resolve) => setTimeout(resolve, 3000));
context.response.body = "Hello World!";
console.log(`Request ended at: ${new Date().toISOString()}`);
});
await app.listen({ port: 80 });
oak 예제입니다
클라이언트 크롬 탭 두개 띄워놓고 동시에 요청하면 두번째 탭은 6초가 지나서야 결과를 받아 볼 수 있습니다.
1. await 뒤에 setTimeout이 쿼리와 같은 3초정도 걸리는 다른 작업일 때도 결과가 똑같은지
2. 만약 이런식으로 시간이 걸리는 작업이 다른 요청을 차단한다면 scaling 말고 다른 처리 방식이 있는지
가 궁금합니다.
고수님들 알려주세용
댓글 0