add resolver queue per debrid
This commit is contained in:
@@ -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));
|
||||||
}));
|
}));
|
||||||
|
|||||||
Reference in New Issue
Block a user