NUDelta / orchestration-engine

Scripts to guide situated actions, powered by programming constructs that model ways of working
0 stars 0 forks source link

feedback opportunity's timestamp isn't rounded, which causes issues in feedback delivery #13

Open kapil1garg opened 2 years ago

kapil1garg commented 2 years ago

While the triggering and expiry timestamps are both rounded down to the nearest 5 minutes (as is the timestamp used to check when scripts are triggered or expired), the timestamp for feedback opportunity is not (see here). Below is an example of what the computed timestamps look like on the database:

image

With how the execution code is currently written, this causes scripts to not deliver feedback when they are suppose to (culprit here).

Some ways to fix it:

For testing, also good to add some jitter to the simulation timestamps (see here). The reason my tests didn't catch this before is because the simulation would always cause the timestamp to be rounded to the nearest 5 minutes since the system clock gets locked at that time during the simulation, whereas it takes time on the server and thus is no longer locked. Adding jitter to the timestamp allows us to simulate this happening so that the code tests can be more robust.

kapil1garg commented 2 years ago

re-opening since the current fix is kinda jank (but should be working)