diff options
Diffstat (limited to 'app/javascript')
-rw-r--r-- | app/javascript/controllers/timer_controller.js | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/app/javascript/controllers/timer_controller.js b/app/javascript/controllers/timer_controller.js index f6ba4f3..1af1e10 100644 --- a/app/javascript/controllers/timer_controller.js +++ b/app/javascript/controllers/timer_controller.js @@ -38,13 +38,16 @@ export default class extends Controller { url: controller.postUrlValue, success: () => { this.postFailures = 0; + App.timerWorker.postMessage({ "set_timeout": 10 }); }, error: (e, xhr) => { this.postFailures++; if (this.postFailures < 3) { - setTimeout(controller.finishActivity, 1000); // 1 second - } else if (xhr === "") { - setTimeout(controller.finishActivity, 60000); // 1 minute + App.timerWorker.postMessage({ "run_flag": true }); + App.timerWorker.postMessage({ "set_timeout": 1000 }); + } else if (this.postFailures < 5 || xhr === "") { + App.timerWorker.postMessage({ "run_flag": true }); + App.timerWorker.postMessage({ "set_timeout": 60000 }); } }, }); |