|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
526 bytes
|
| Line | |
|---|
| 1 | function runWithRetry(callback, maxRetries) {
|
|---|
| 2 | function executeWithRetryAndTimeout(currentCount) {
|
|---|
| 3 | try {
|
|---|
| 4 | if (currentCount > maxRetries - 1) {
|
|---|
| 5 | console.warn('[React Refresh] Failed to set up the socket connection.');
|
|---|
| 6 | return;
|
|---|
| 7 | }
|
|---|
| 8 |
|
|---|
| 9 | callback();
|
|---|
| 10 | } catch (err) {
|
|---|
| 11 | setTimeout(
|
|---|
| 12 | function () {
|
|---|
| 13 | executeWithRetryAndTimeout(currentCount + 1);
|
|---|
| 14 | },
|
|---|
| 15 | Math.pow(10, currentCount)
|
|---|
| 16 | );
|
|---|
| 17 | }
|
|---|
| 18 | }
|
|---|
| 19 |
|
|---|
| 20 | executeWithRetryAndTimeout(0);
|
|---|
| 21 | }
|
|---|
| 22 |
|
|---|
| 23 | module.exports = runWithRetry;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.