Added timeouts to Modules

master
masterhc 1 year ago
parent ab1384e491
commit d3ca63db86

@ -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);

@ -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);

Loading…
Cancel
Save