PR comment 2.
This commit is contained in:
parent
5b1850d28f
commit
9129e47dd9
|
@ -249,7 +249,7 @@ function resyncDefinitionsRequired(status: number, message: string) {
|
||||||
export async function search(
|
export async function search(
|
||||||
options: RowSearchParams,
|
options: RowSearchParams,
|
||||||
table: Table,
|
table: Table,
|
||||||
opts?: { retries?: number }
|
opts?: { retrying?: boolean }
|
||||||
): Promise<SearchResponse<Row>> {
|
): Promise<SearchResponse<Row>> {
|
||||||
let { paginate, query, ...params } = options
|
let { paginate, query, ...params } = options
|
||||||
|
|
||||||
|
@ -374,10 +374,9 @@ export async function search(
|
||||||
return response
|
return response
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
const msg = typeof err === "string" ? err : err.message
|
const msg = typeof err === "string" ? err : err.message
|
||||||
const firstTry = !opts?.retries || opts.retries === 0
|
if (!opts?.retrying && resyncDefinitionsRequired(err.status, msg)) {
|
||||||
if (firstTry && resyncDefinitionsRequired(err.status, msg)) {
|
|
||||||
await sdk.tables.sqs.syncDefinition()
|
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
|
// previously the internal table didn't error when a column didn't exist in search
|
||||||
if (err.status === 400 && msg?.match(MISSING_COLUMN_REGEX)) {
|
if (err.status === 400 && msg?.match(MISSING_COLUMN_REGEX)) {
|
||||||
|
|
Loading…
Reference in New Issue