Time based events/triggers

I’m curious to design patterns people use for time based events.
Scenario: An event is happening at some timestamp, lets say a betting game and the round allows betting up to a timestamp, then runs the game.
Checking the current time to block any new user from submitting a bet is easy enough with a timestamp check when a user calls the betting method.
BUT the problem I’m having is around executing it at the correct time. The options on playing with are

  1. have something live outside the internet computer that sends execute triggers to the canister at the correct time. But with that you have to rely on the outside source and can’t guarantee that it will trigger at the right time
  2. when the users request the results of the game, make that method call an update method, and if the game has not been executed yet than execute it right then. The problem I see with this is potentially thousands of clients all calling an update method all around the same time even though 99% of them could have done a query call
  3. some hybrid between the two where most of the time the trigger will execute it and not the player. If the players get back a result that has not been executed yet, the player themselves can trigger it with a separate request, but that potentially would have the same issue of many unnecessary update calls from clients

Curious if other people have tried to tackle this problem

2 Likes
2 Likes

Wow. Don’t know how i missed ‘heartbeat’, that changes everything. Tyvm

2 Likes