forked from pinks/eris
add todo
This commit is contained in:
parent
9155d513b5
commit
8e81f82d8b
|
@ -32,13 +32,15 @@ bot.api.config.use(async (prev, method, payload, signal) => {
|
||||||
let timedOut = false;
|
let timedOut = false;
|
||||||
const timeout = setTimeout(() => {
|
const timeout = setTimeout(() => {
|
||||||
timedOut = true;
|
timedOut = true;
|
||||||
|
// TODO: this sometimes throws with "can't abort a locked stream" and crashes whole process
|
||||||
controller.abort();
|
controller.abort();
|
||||||
}, 30 * 1000);
|
}, 30 * 1000);
|
||||||
signal?.addEventListener("abort", () => {
|
signal?.addEventListener("abort", () => {
|
||||||
controller.abort();
|
controller.abort();
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
return await prev(method, payload, controller.signal);
|
const result = await prev(method, payload, controller.signal);
|
||||||
|
return result;
|
||||||
} finally {
|
} finally {
|
||||||
clearTimeout(timeout);
|
clearTimeout(timeout);
|
||||||
if (timedOut) {
|
if (timedOut) {
|
||||||
|
|
Loading…
Reference in New Issue