From 72055c6832efae1e28b360cf46a08bc435df1fe0 Mon Sep 17 00:00:00 2001 From: jacoblee93 Date: Wed, 7 Feb 2024 16:29:04 -0800 Subject: [PATCH] Adds batch tracing support check --- js/src/client.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/js/src/client.ts b/js/src/client.ts index b650642c0..6537d501f 100644 --- a/js/src/client.ts +++ b/js/src/client.ts @@ -647,7 +647,22 @@ export class Client { signal: AbortSignal.timeout(this.timeout_ms), } ); - await raiseForStatus(response, "batch create run"); + if (response.status === 404) { + this.autoBatchTracing = false; + for (const preparedCreateParam of body.post) { + await this.createRun(preparedCreateParam as CreateRunParams); + } + for (const preparedUpdateParam of body.patch) { + if (preparedUpdateParam.id !== undefined) { + await this.updateRun( + preparedUpdateParam.id, + preparedUpdateParam as UpdateRunParams + ); + } + } + } else { + await raiseForStatus(response, "batch create run"); + } } public async updateRun(runId: string, run: RunUpdate): Promise {