Skip to content

Commit

Permalink
consolidate subsequent calls into finally clause
Browse files Browse the repository at this point in the history
  • Loading branch information
mlhenderson committed Jul 26, 2023
1 parent eef288d commit b6df441
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,19 +112,12 @@ class RefreshAnnouncements {
} catch (e) {
// there was an error with fetching
console.log(e);

// call again in n microseconds (maybe the API is only down for a little bit)
} finally {
// wait n microseconds and check again
setTimeout(() => {
this.fetchAnnouncement(url, n);
}, n);

return;
}

// wait n microseconds and check again
setTimeout(() => {
this.fetchAnnouncement(url, n);
}, n);
}
}

Expand Down

0 comments on commit b6df441

Please sign in to comment.