diff options
| author | Adam Soltys <[email protected]> | 2024-10-30 16:37:00 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2024-10-30 16:37:07 -0700 |
| commit | b3203b848a25b5aadebfe8fff3e0f01dda1919fa (patch) | |
| tree | d03f4fc7f236e4291d9cd50ac7915a05614f642a /lib | |
| parent | 3c68cfff325df95812cd7c9be8bf476fd4481f41 (diff) | |
| download | coinos-server-b3203b848a25b5aadebfe8fff3e0f01dda1919fa.tar.gz coinos-server-b3203b848a25b5aadebfe8fff3e0f01dda1919fa.zip | |
check for nil locations
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/locations.ts | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/locations.ts b/lib/locations.ts index 74baf7e6..bb8b08cf 100644 --- a/lib/locations.ts +++ b/lib/locations.ts @@ -18,7 +18,7 @@ const dedup = (array) => export const getLocations = async () => { try { - const previous = await g("locations"); + const previous = await g("locations") || []; let since = await g("locations:since"); if (!since) since = "2022-09-19T00:00:00Z"; if (Date.now() - new Date(since).getTime() < 60000) return; @@ -56,6 +56,7 @@ export const getLocations = async () => { await s("locations", dedup(locations)); await s("locations:since", `${new Date().toISOString().split(".")[0]}Z`); } catch (e) { + console.log(e); err("problem fetching locations", e); } |
