From ee501f70ed161055ca66e0a8769b15ba0da5cd69 Mon Sep 17 00:00:00 2001 From: advplyr Date: Sun, 9 Jun 2024 12:51:28 -0500 Subject: [PATCH] Auto-formatting --- server/providers/Audnexus.js | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/server/providers/Audnexus.js b/server/providers/Audnexus.js index 1756bfd8..e34402e4 100644 --- a/server/providers/Audnexus.js +++ b/server/providers/Audnexus.js @@ -73,8 +73,8 @@ class Audnexus { Logger.info(`[Audnexus] Searching for author "${authorRequestUrl}"`) return this._processRequest(this.limiter(() => axios.get(authorRequestUrl))) - .then(res => res.data) - .catch(error => { + .then((res) => res.data) + .catch((error) => { Logger.error(`[Audnexus] Author request failed for ${asin}`, error) return null }) @@ -89,13 +89,14 @@ class Audnexus { async findAuthorByASIN(asin, region) { const author = await this.authorRequest(asin, region) - return author ? - { - asin: author.asin, - description: author.description, - image: author.image || null, - name: author.name - } : null + return author + ? { + asin: author.asin, + description: author.description, + image: author.image || null, + name: author.name + } + : null } /** @@ -138,8 +139,8 @@ class Audnexus { Logger.debug(`[Audnexus] Get chapters for ASIN ${asin}/${region}`) return this._processRequest(this.limiter(() => axios.get(`${this.baseUrl}/books/${asin}/chapters?region=${region}`))) - .then(res => res.data) - .catch(error => { + .then((res) => res.data) + .catch((error) => { Logger.error(`[Audnexus] Chapter ASIN request failed for ${asin}/${region}`, error) return null }) @@ -156,7 +157,7 @@ class Audnexus { const retryAfter = parseInt(error.response.headers?.['retry-after'], 10) || 5 Logger.warn(`[Audnexus] Rate limit exceeded. Retrying in ${retryAfter} seconds.`) - await new Promise(resolve => setTimeout(resolve, retryAfter * 1000)) + await new Promise((resolve) => setTimeout(resolve, retryAfter * 1000)) return this._processRequest(request) }