aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2024-10-19 21:39:57 -0700
committerAdam Soltys <[email protected]>2024-10-19 21:39:57 -0700
commit985230492f0c2543952bbac01378c033cced7d55 (patch)
treeec0b1c3bd19b0885329f53aad65a87a19573c85a /lib
parent1d5053feb4a5f9b2ea477676f437aef5c7fb7c5d (diff)
downloadcoinos-server-985230492f0c2543952bbac01378c033cced7d55.tar.gz
coinos-server-985230492f0c2543952bbac01378c033cced7d55.zip
de-dupe locations
Diffstat (limited to 'lib')
-rw-r--r--lib/locations.ts7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/locations.ts b/lib/locations.ts
index 560d5259..11981c19 100644
--- a/lib/locations.ts
+++ b/lib/locations.ts
@@ -1,7 +1,7 @@
import { err } from "$lib/logging";
import got from "got";
import { g, s } from "$lib/db";
-import { fields, pick } from "$lib/utils";
+import { fields, pick, uniq } from "$lib/utils";
export let getLocations = async () => {
try {
@@ -40,7 +40,10 @@ export let getLocations = async () => {
locations.push(...previous);
- await s("locations", locations);
+ await s(
+ "locations",
+ uniq(locations, (l) => l.id),
+ );
await s("locations:since", new Date().toISOString().split(".")[0] + "Z");
} catch (e) {
err("problem fetching locations", e);