Skip to content
This repository has been archived by the owner on Dec 6, 2023. It is now read-only.

Server: catch up on missed ticks #218

Merged

Conversation

kemenaran
Copy link
Contributor

This is a fix for #143

The issue

As outlined in the issue, every second the plugin ticks to trigger reminder occurrences. However various reasons might cause the tick to miss a second or more: server jittery (very frequent), or a temporary downtime or upgrade. In those case, some occurrences will never be triggered.

The fix

This PR saves the last tick time in a LastTickAt key, and uses it to catch up on missed ticks.

If the server has been down for more than 10mn, older ticks are dropped (in order not to hammer the database by catching up on a 20 000 ticks at once).

The implementation

This PR has two commit:

  1. Simple detection: detect missed ticks, and log a warning message in those case;
  2. Acting on missed ticks: actually trigger the reminders for those ticks.

It should be quite readable, and has tests.

@scottleedavis @hanzei does that look good to you?

kemenaran added 2 commits May 9, 2022 14:38
On heavy load, or when upgrading the server, the plugin might not
tick every seconds. To better quantify this, log when some ticks
are missed.
Catches up ticks up to 10 minutes (as longer may overload the server
when starting up after being stopped a very long time).

If it takes longer to catch up for ticks that a tick, the missed
ticks will be caught up on the next turn.
@hanzei hanzei removed their request for review October 22, 2022 14:51
@scottleedavis
Copy link
Owner

awaiting response from mm team regarding #195 (comment) before movement on this pull request

@scottleedavis scottleedavis merged commit 1f98568 into scottleedavis:master Mar 14, 2023
@kemenaran
Copy link
Contributor Author

Thanks!

In my real-life tests, this didn’t entirely prevent recurring reminders to be dropped from time to time - but it helped a lot to make this less frequent.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants