From 9e094eb542de86e277f96e6e80b062eb630ea1bc Mon Sep 17 00:00:00 2001 From: casulit Date: Tue, 29 Oct 2024 22:13:54 +0800 Subject: [PATCH] fix(config): Handle error by setting is_process flag in Deno KV listener --- config/deno-kv.ts | 8 ++++++++ server.ts | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/config/deno-kv.ts b/config/deno-kv.ts index e700686..74fe794 100644 --- a/config/deno-kv.ts +++ b/config/deno-kv.ts @@ -518,6 +518,14 @@ export async function listenQueue(kv: Deno.Kv) { console.info("1 record updated in lamudi_raw_data"); } } catch (error) { + await client2.queryObject({ + args: [rawProperty.id], + text: ` + UPDATE lamudi_raw_data + SET is_process = TRUE + WHERE id = $1 + `, + }); throw error; } } diff --git a/server.ts b/server.ts index cd692ad..511448a 100644 --- a/server.ts +++ b/server.ts @@ -104,7 +104,7 @@ app.get("/api/properties", async (c: Context) => { if (query.search) { addWhereCondition( `to_tsvector('english', l.title || ' ' || l.description) @@ plainto_tsquery($${paramCounter})`, - query.search + query.search, ); }