From 35c59b3d20c9f59cc969206734b2a0456915f2b6 Mon Sep 17 00:00:00 2001 From: Akshay Shekhawat Date: Tue, 8 Nov 2022 15:56:38 -0800 Subject: [PATCH] add sleep to analyze loop --- backend/src/analyze-traces.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/backend/src/analyze-traces.ts b/backend/src/analyze-traces.ts index be969df8..44787fb4 100644 --- a/backend/src/analyze-traces.ts +++ b/backend/src/analyze-traces.ts @@ -68,6 +68,8 @@ WHERE "apiEndpointUuid" = $1 ` +const sleep = (ms: number) => new Promise(res => setTimeout(res, ms)) + const getQueuedApiTrace = async (): Promise<{ trace: QueuedApiTrace ctx: MetloContext @@ -284,6 +286,8 @@ const analyzeTraces = async (): Promise => { await generateEndpoint(ctx, trace, queryRunner) } } + } else { + await sleep(50) } } catch (err) { console.error(`Encountered error while analyzing traces: ${err}`)