From d3ca63db86f51db8c2dc3e4d6f3da335af7b6ea9 Mon Sep 17 00:00:00 2001 From: masterhc Date: Thu, 18 Apr 2024 13:13:09 +0100 Subject: [PATCH] Added timeouts to Modules --- Modules/AsuraModule.js | 11 ++++++----- Modules/ReaperModule.js | 12 ++++++------ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/Modules/AsuraModule.js b/Modules/AsuraModule.js index f68411e..a1e1ce9 100644 --- a/Modules/AsuraModule.js +++ b/Modules/AsuraModule.js @@ -11,6 +11,7 @@ module.exports = class AsuraModule { this.scanlator = 'Asura-scans' this.BaseLink = 'https://asuratoon.com/' + this.timeout = 5000; } /** * @@ -25,7 +26,7 @@ module.exports = class AsuraModule */ async Search(query) { - return await fetch(this.BaseLink+'?s='+query) + return await fetch(this.BaseLink+'?s='+query, {timeout:this.timeout}) .then(handleResponse) .then(handleData) .catch(handleError); @@ -69,7 +70,7 @@ module.exports = class AsuraModule */ async SearchByTag(query, ammount=5) { - return await fetch(this.BaseLink+'/genres/'+query) + return await fetch(this.BaseLink+'/genres/'+query, {timeout:this.timeout}) .then(handleResponse) .then(handleData) .catch(handleError); @@ -118,7 +119,7 @@ module.exports = class AsuraModule */ async ChapterList(link, name) { - return await fetch(link) + return await fetch(link, {timeout:this.timeout}) .then(handleResponse) .then(handleData) .catch(handleError); @@ -168,7 +169,7 @@ module.exports = class AsuraModule */ async Chapter(Link) { - return await fetch(Link) + return await fetch(Link, {timeout:this.timeout}) .then(handleResponse) .then(handleData) .catch(handleError); @@ -216,7 +217,7 @@ module.exports = class AsuraModule async GetManga(Link, title) { const auxTitle = title; - return await fetch(Link) + return await fetch(Link, {timeout:this.timeout}) .then(handleResponse) .then(handleData) .catch(handleError); diff --git a/Modules/ReaperModule.js b/Modules/ReaperModule.js index 41a37f0..26ee6e8 100644 --- a/Modules/ReaperModule.js +++ b/Modules/ReaperModule.js @@ -12,7 +12,7 @@ module.exports = class ReaperModule { this.scanlator = 'Reaper-scans'; this.BaseLink = 'https://reaper-scans.com/'; - + this.timeout = 5000; } /** * @@ -28,7 +28,7 @@ module.exports = class ReaperModule */ async Search(query) { - return await fetch(this.BaseLink+'?s='+query) + return await fetch(this.BaseLink+'?s='+query, {timeout:this.timeout}) .then(handleResponse) .then(handleData) .catch(handleError); @@ -72,7 +72,7 @@ module.exports = class ReaperModule */ async SearchByTag(query, ammount=5) { - return await fetch(this.BaseLink+'genres/'+query) + return await fetch(this.BaseLink+'genres/'+query, {timeout:this.timeout}) .then(handleResponse) .then(handleData) .catch(handleError); @@ -121,7 +121,7 @@ module.exports = class ReaperModule */ async ChapterList(link, name) { - return await fetch(link) + return await fetch(link, {timeout:this.timeout}) .then(handleResponse) .then(handleData) .catch(handleError); @@ -171,7 +171,7 @@ module.exports = class ReaperModule */ async Chapter(Link) { - return await fetch(Link) + return await fetch(Link, {timeout:this.timeout}) .then(handleResponse) .then(handleData) .catch(handleError); @@ -219,7 +219,7 @@ module.exports = class ReaperModule async GetManga(Link, title) { const auxTitle = title; - return await fetch(Link) + return await fetch(Link, {timeout:this.timeout}) .then(handleResponse) .then(handleData) .catch(handleError);