Skip to content
Snippets Groups Projects
Commit b316f89b authored by Ayc0's avatar Ayc0
Browse files

Simplify TTL use in interval

parent 0d2d0501
No related branches found
No related tags found
No related merge requests found
......@@ -19,10 +19,7 @@ const interval = (fn, initialTTL, output = {}) => {
if (this.cleared) {
return;
}
TTL = fn();
if (TTL instanceof Promise) {
TTL = await TTL;
}
TTL = await Promise.resolve(fn());
} catch (error) {
console.error(error);
TTL = initialTTL;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment