From d6ed03028dfdf9026b34f40c320fb62e348b2875 Mon Sep 17 00:00:00 2001 From: FoxxMD Date: Tue, 5 May 2026 20:59:05 +0000 Subject: [PATCH] fix(lastfm): Increase connection test timeout for slow networks --- src/backend/common/vendor/LastfmApiClient.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/backend/common/vendor/LastfmApiClient.ts b/src/backend/common/vendor/LastfmApiClient.ts index 6b10f191..524a06f9 100644 --- a/src/backend/common/vendor/LastfmApiClient.ts +++ b/src/backend/common/vendor/LastfmApiClient.ts @@ -18,6 +18,7 @@ import { IncomingMessage } from "http"; import { baseFormatPlayObj } from "../../utils/PlayTransformUtils.js"; import { ScrobbleSubmitError, SimpleError } from "../errors/MSErrors.js"; import { redactString } from "@foxxmd/redact-string"; +import dns from 'node:dns/promises'; const badErrors = [ 'api key suspended', @@ -226,7 +227,11 @@ export default class LastfmApiClient extends AbstractApiClient implements Pagina testConnection = async() => { try { - await isPortReachableConnect(this.url.port, { host: this.url.url.hostname }); + this.logger.trace(`Looking up IP for ${this.url.url.hostname}`); + const resolved = await dns.lookup(this.url.url.hostname); + this.logger.trace(`${this.url.url.hostname} resolved to ${resolved.address}`); + this.logger.trace(`Checking if ${this.url.url.hostname}:${this.url.port} is reachable...`); + await isPortReachableConnect(this.url.port, { host: this.url.url.hostname, timeout: 2000 }); this.logger.verbose(`${this.url.url.hostname}:${this.url.port} is reachable.`); return true; } catch (e) { -- 2.51.2