From 9129e47dd941213391fba1b59c8f46431a867e74 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Thu, 11 Jul 2024 17:09:41 +0100 Subject: [PATCH] PR comment 2. --- packages/server/src/sdk/app/rows/search/sqs.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/server/src/sdk/app/rows/search/sqs.ts b/packages/server/src/sdk/app/rows/search/sqs.ts index 4bf3c374e4..7042d6fa2c 100644 --- a/packages/server/src/sdk/app/rows/search/sqs.ts +++ b/packages/server/src/sdk/app/rows/search/sqs.ts @@ -249,7 +249,7 @@ function resyncDefinitionsRequired(status: number, message: string) { export async function search( options: RowSearchParams, table: Table, - opts?: { retries?: number } + opts?: { retrying?: boolean } ): Promise> { let { paginate, query, ...params } = options @@ -374,10 +374,9 @@ export async function search( return response } catch (err: any) { const msg = typeof err === "string" ? err : err.message - const firstTry = !opts?.retries || opts.retries === 0 - if (firstTry && resyncDefinitionsRequired(err.status, msg)) { + if (!opts?.retrying && resyncDefinitionsRequired(err.status, msg)) { await sdk.tables.sqs.syncDefinition() - return search(options, table, { retries: 1 }) + return search(options, table, { retrying: true }) } // previously the internal table didn't error when a column didn't exist in search if (err.status === 400 && msg?.match(MISSING_COLUMN_REGEX)) {