summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Gay <david@davidgay.org>2021-06-06 12:22:30 -0400
committerDavid Gay <david@davidgay.org>2021-06-06 12:22:42 -0400
commitb477eb3f9b66cfc2794d56807928996f5a4e2362 (patch)
tree35d3558c057284a6d847b2eddcad8c8426c067f8
parentd701cf456bba209f31387db6b43bf26b1251e188 (diff)
Tweak finish activity retry code to avoid flooding Honeybadger
-rw-r--r--CHANGELOG.md7
-rw-r--r--app/javascript/controllers/timer_controller.js10
2 files changed, 12 insertions, 5 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0f9a00c..c031cef 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,13 @@ All notable changes to this project will be documented in this file.
### UI
- New inventory view, with items sorted into categories, and a (hopefully) better section for equipped items.
+### Networking
+- Finish activity retries will now occur every second until 3 total failures have occurred. If no xhr comes back in the
+ request (likely indicating a problem reaching the server), the retries will continue, once every minute. If an xhr
+ is returned from the server, the retries will cease after 3 failures to avoid flooding our new error monitoring.
+ I will monitor and potentially improve this system (and the finish activity code) as time goes forward, but this
+ should be sufficient for now.
+
## [0.1.7.2] - 2021-06-05
### UI
diff --git a/app/javascript/controllers/timer_controller.js b/app/javascript/controllers/timer_controller.js
index dcf046a..4888f6a 100644
--- a/app/javascript/controllers/timer_controller.js
+++ b/app/javascript/controllers/timer_controller.js
@@ -43,12 +43,12 @@ export default class extends Controller {
success: () => {
this.postFailures = 0;
},
- error: () => {
+ error: (e, xhr) => {
this.postFailures++;
- if (this.postFailures < 5) {
- setTimeout(controller.finishActivity, 1000);
- } else {
- setTimeout(controller.finishActivity, 60000);
+ if (this.postFailures < 3) {
+ setTimeout(controller.finishActivity, 1000); // 1 second
+ } else if (xhr === "") {
+ setTimeout(controller.finishActivity, 60000); // 1 minute
}
},
});