From 58e996a4ac227162f171e84530fe898cb504e045 Mon Sep 17 00:00:00 2001 From: John Barratt Date: Tue, 28 Feb 2023 12:20:10 -0800 Subject: add db connect try catch and commit before pull --- lib/db.js | 7 ++++++- lib/locations.js | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/db.js b/lib/db.js index 94538abb..7b7fefdb 100644 --- a/lib/db.js +++ b/lib/db.js @@ -3,7 +3,12 @@ import { sleep } from "$lib/utils"; import { createClient } from "redis"; export const db = createClient({ url: config.db }); -await db.connect(); +try { + await db.connect(); + console.log("CONNECTED") +} catch (e) { + console.log("FAILED CONNECTION") +} export default db; export let g = async k => { diff --git a/lib/locations.js b/lib/locations.js index 39883555..be2df811 100644 --- a/lib/locations.js +++ b/lib/locations.js @@ -10,7 +10,7 @@ export let getLocations = async () => { locations = locations.filter( l => l["osm_json"].tags && l["osm_json"].tags["payment:coinos"] === "yes" ); - + await s("locations", locations); } catch (e) {} -- cgit v1.2.3