diff options
| author | Adam Soltys <[email protected]> | 2024-10-19 21:39:57 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2024-10-19 21:39:57 -0700 |
| commit | 985230492f0c2543952bbac01378c033cced7d55 (patch) | |
| tree | ec0b1c3bd19b0885329f53aad65a87a19573c85a /lib | |
| parent | 1d5053feb4a5f9b2ea477676f437aef5c7fb7c5d (diff) | |
| download | coinos-server-985230492f0c2543952bbac01378c033cced7d55.tar.gz coinos-server-985230492f0c2543952bbac01378c033cced7d55.zip | |
de-dupe locations
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/locations.ts | 7 |
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); |
