fix(worker): avoid workers getting blocked
This commit is contained in:
@@ -183,6 +183,10 @@ function getSessionEndWithPriority(
|
|||||||
return async (args) => {
|
return async (args) => {
|
||||||
const res = await getSessionEnd(args);
|
const res = await getSessionEnd(args);
|
||||||
|
|
||||||
|
if (count > 10) {
|
||||||
|
throw new Error('Failed to get session end');
|
||||||
|
}
|
||||||
|
|
||||||
// if we get simultaneous requests we want to avoid race conditions with getting the session end
|
// if we get simultaneous requests we want to avoid race conditions with getting the session end
|
||||||
// one of the events will get priority and the other will wait for the first to finish
|
// one of the events will get priority and the other will wait for the first to finish
|
||||||
if (res === null && priority === false) {
|
if (res === null && priority === false) {
|
||||||
@@ -190,10 +194,6 @@ function getSessionEndWithPriority(
|
|||||||
return getSessionEndWithPriority(priority, count + 1)(args);
|
return getSessionEndWithPriority(priority, count + 1)(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count > 10) {
|
|
||||||
throw new Error('Failed to get session end');
|
|
||||||
}
|
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user