It behaves in two different ways:
- when created, the last run is set to
now() - cooldown period- so that it immediately starts recording the events.
- when updated, the last run is not changed. Only the cooldown period is changed. I'll describe below:
- 9:50 trigger created with cooldown period: 2h (last run set to 09:50 minus cooldown 02:00 = 07:50, so 2h cooldown ends at 09:50)
- 10:00 table is updated, cooldown not in effect
- 10:00 trigger fired → "last run" = 10:00 (cooldown would end at 12:00)
- 10:01 trigger updated, set cooldown = 5min (cooldown is still in effect, but only until 10:05 - last run 10:00 + cooldown 00:05)
To to sum up - when created the cooldown is not in effect for the first run. When updated it's immediately recalculated, but it's still effective.