From d04d54adea9a71d41bec07d0c2d40b164047674f Mon Sep 17 00:00:00 2001 From: zdm Date: Wed, 12 Jul 2023 05:03:24 +0300 Subject: [PATCH] fix: update resource on add --- bin/update.js | 2 +- lib/geoip-asn.js | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/bin/update.js b/bin/update.js index d41cec4..7885b64 100644 --- a/bin/update.js +++ b/bin/update.js @@ -18,7 +18,7 @@ const CLI = { await Cli.parse( CLI ); -await externalResources.add( "softvisio-node/geoip-asn/resources/geolite2-asn", import.meta.url, { "update": false } ); +externalResources.add( "softvisio-node/geoip-asn/resources/geolite2-asn", import.meta.url ); const res = await externalResources.update( { "remote": true, diff --git a/lib/geoip-asn.js b/lib/geoip-asn.js index bdd899f..6ca8f28 100644 --- a/lib/geoip-asn.js +++ b/lib/geoip-asn.js @@ -7,8 +7,10 @@ const cache = new CacheLru( { "maxSize": 1000 } ); var mmdb; -const resource = await externalResources.add( "softvisio-node/geoip-asn/resources/geolite2-asn", import.meta.url ); -resource.on( "update", () => ( mmdb = null ) ); +const resource = await externalResources + .add( "softvisio-node/geoip-asn/resources/geolite2-asn", import.meta.url ) + .on( "update", () => ( mmdb = null ) ) + .check(); class GeoipAsn { constructor () {}