diff options
author | David Gay <david@davidgay.org> | 2021-06-07 21:24:02 -0400 |
---|---|---|
committer | David Gay <david@davidgay.org> | 2021-06-07 21:24:02 -0400 |
commit | 39178217ecf722fbd902e07a053e35fa290488f8 (patch) | |
tree | 818522cf10f801a4ec33f73fed7fb1bd5e214e93 /app | |
parent | b6955ee9aa0058f64f6e3b6314d2b7358939bc2e (diff) |
Hook in new web worker stuff with finish activity POST retry stuff
Diffstat (limited to 'app')
-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 }); } }, }); |