Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix falsely suspended timeago alarms #5170

Merged

Commits on Oct 31, 2019

  1. Fix continuous suspension of the timeago alerts

    The default hearbeat-setting is 60 seconds, so the delta between two
    timeago-checks will always be >15 seconds and the timeago-alarms will
    always be suspended (that's what Papertrail also shows).
    
    To fix this, make the delta-check heartbeat-setting-dependant and also simplify
    the code by using just 1 variable.
    fibbers committed Oct 31, 2019
    Configuration menu
    Copy the full SHA
    7a4cc71 View commit details
    Browse the repository at this point in the history
  2. Add test that verifies the hibernation detection behaviour

    The real-world test would be to actually wait for a couple of minutes (with 2 *
    heartbeat of default settings) in the unit test, but this is not feasible, so
    just modify the heartbeat-setting to a lower value.
    
    I tested it by only running tests inside `tests/timeago.test.js` and by actually
    deploying this code and testing the alarms with Pushover and reading the logs in
    Papertrail.
    
    Before this change, I saw a 'Hibernation detected' log every minute. After this
    change, I didn't see it anymore, probably because the app wasn't actually
    hibernated (yet).
    fibbers committed Oct 31, 2019
    Configuration menu
    Copy the full SHA
    aa52a81 View commit details
    Browse the repository at this point in the history

Commits on Nov 2, 2019

  1. Take sulkaharo's feedback into account and differentiate

    between client and server (by introducing it in sandbox.js).
    
    On the client the behaviour is different from the server:
    
    > On client, the issue is browsers stop the execution of JS if the window is not
    > visible and the alarm is falsely triggered immediately when the execution is
    > resumed, so we need to suspend the alarm for ~10 seconds after the execution has
    > resumed to give the client time to update the data to prevent false alarms.
    
    While on the server, the default heartbeat from 60s needs to be taken
    into account to prevent the timeago alarm from falsely triggering.
    So detect hibernation there if the last check was more than 2 heartbeats ago.
    fibbers committed Nov 2, 2019
    Configuration menu
    Copy the full SHA
    805732a View commit details
    Browse the repository at this point in the history

Commits on Nov 4, 2019

  1. Fix the tests by adding settings to the context,

    which is now required by timeago.
    
    Also, change the timeago test a bit so that it both succeeds
    when testing in isolation as when testing it along with the other tests.
    fibbers committed Nov 4, 2019
    Configuration menu
    Copy the full SHA
    eb7ae31 View commit details
    Browse the repository at this point in the history