cacheable-lookup
Advanced tools
Comparing version 5.0.3 to 5.0.4
{ | ||
"name": "cacheable-lookup", | ||
"version": "5.0.3", | ||
"version": "5.0.4", | ||
"description": "A cacheable dns.lookup(…) that respects the TTL", | ||
"engines": { | ||
"node": ">=10" | ||
"node": ">=10.6.0" | ||
}, | ||
@@ -8,0 +8,0 @@ "files": [ |
@@ -209,3 +209,7 @@ 'use strict'; | ||
cached = await newPromise; | ||
try { | ||
cached = await newPromise; | ||
} finally { | ||
delete this._pending[hostname]; | ||
} | ||
} | ||
@@ -324,25 +328,17 @@ } | ||
try { | ||
let query = await this._resolve(hostname); | ||
let query = await this._resolve(hostname); | ||
if (query.entries.length === 0 && this._fallback) { | ||
query = await this._lookup(hostname); | ||
if (query.entries.length === 0 && this._fallback) { | ||
query = await this._lookup(hostname); | ||
if (query.entries.length !== 0) { | ||
// Use `dns.lookup(...)` for that particular hostname | ||
this._hostnamesToFallback.add(hostname); | ||
} | ||
if (query.entries.length !== 0) { | ||
// Use `dns.lookup(...)` for that particular hostname | ||
this._hostnamesToFallback.add(hostname); | ||
} | ||
} | ||
const cacheTtl = query.entries.length === 0 ? this.errorTtl : query.cacheTtl; | ||
await this._set(hostname, query.entries, cacheTtl); | ||
const cacheTtl = query.entries.length === 0 ? this.errorTtl : query.cacheTtl; | ||
await this._set(hostname, query.entries, cacheTtl); | ||
delete this._pending[hostname]; | ||
return query.entries; | ||
} catch (error) { | ||
delete this._pending[hostname]; | ||
throw error; | ||
} | ||
return query.entries; | ||
} | ||
@@ -349,0 +345,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23919
477