Trying to build some triggers which act not based on “events” but more focused on the heartbeat. The idea was to have the trigger execute fully once a day. However, under its logic several exercises are being executed and get in flight. One of these exercises would create a contract which would lock any other trigger executions from the get go (the trigger validates whether that contract exists for the currentDate and if it does, it does not continue).
However, we’ve witnessed a lack of order guarantee on those async calls. Therefore, it is possible for another contract to initialise the trigger and the contract which would block its execution is still not persisted.
We tried to figure out a couple of solutions:
- Guarantee no commands are in flight, therefore all is persisted (works but it’s not a pretty or scalable solution)
- Check for commands in flight and whether the specific command that we need persisted is still in flight
(that command creates the control contract for the currentDate and the trigger checks for its existence to continue or not)
This second solution would be more adjusted, however we’re having an issue figuring out how best to check whether the command came from a specific template and from a specific choice
Any help appreciated to get this done or other design solutions that we could approach.