|
|
@ -86,9 +86,20 @@ export const exclusive = (func, cooldown = 2000) => |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
pending = pending |
|
|
|
.then(() => sleep(cooldown)) |
|
|
|
.then(() => func(...args)); |
|
|
|
pending = (async () => |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
await pending; |
|
|
|
} |
|
|
|
catch |
|
|
|
{ |
|
|
|
// Ignore errors from previous executions
|
|
|
|
} |
|
|
|
|
|
|
|
await sleep(cooldown); |
|
|
|
return func(...args); |
|
|
|
})(); |
|
|
|
} |
|
|
|
|
|
|
|
return pending; |
|
|
|