mirror of
https://github.com/TheBeastLT/torrentio-scraper.git
synced 2026-03-11 21:26:53 +00:00
add resolver queue per debrid
This commit is contained in:
parent
3366903107
commit
4c2f4306b1
1 changed files with 7 additions and 3 deletions
|
|
@ -59,9 +59,12 @@ export const MochOptions = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const unrestrictQueue = new namedQueue((task, callback) => task.method()
|
const unrestrictQueues = {}
|
||||||
.then(result => callback(false, result))
|
Object.values(MochOptions)
|
||||||
.catch((error => callback(error))), 20);
|
.map(moch => moch.key)
|
||||||
|
.forEach(mochKey => unrestrictQueues[mochKey] = new namedQueue((task, callback) => task.method()
|
||||||
|
.then(result => callback(false, result))
|
||||||
|
.catch((error => callback(error))), 20));
|
||||||
|
|
||||||
export function hasMochConfigured(config) {
|
export function hasMochConfigured(config) {
|
||||||
return Object.keys(MochOptions).find(moch => config?.[moch])
|
return Object.keys(MochOptions).find(moch => config?.[moch])
|
||||||
|
|
@ -107,6 +110,7 @@ export async function resolve(parameters) {
|
||||||
return StaticResponse.FAILED_UNEXPECTED;
|
return StaticResponse.FAILED_UNEXPECTED;
|
||||||
})
|
})
|
||||||
.then(url => isStaticUrl(url) ? `${parameters.host}/${url}` : url);
|
.then(url => isStaticUrl(url) ? `${parameters.host}/${url}` : url);
|
||||||
|
const unrestrictQueue = unrestrictQueues[moch.key];
|
||||||
return new Promise(((resolve, reject) => {
|
return new Promise(((resolve, reject) => {
|
||||||
unrestrictQueue.push({ id, method }, (error, result) => result ? resolve(result) : reject(error));
|
unrestrictQueue.push({ id, method }, (error, result) => result ? resolve(result) : reject(error));
|
||||||
}));
|
}));
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue