Closed tonyandrewmeyer closed 3 weeks ago
@PietroPasotti I decided it would be better to split this in two - so this PR has the backwards-incompatible simplification of always using _Event.deferred
rather than scenario.deferred()
or instantiating DeferredEvent
manually (although that's only discouraged, not prohibited), plus the missing snapshot data. I'm hoping this is fairly uncontentious.
I'll do a separate PR afterwards that has the backwards-compatible "find a handler automatically if possible" feature.
A couple of changes to simplify setting up the queue of deferred events:
DeferredEvent
to strongly suggest that it's for internal use only and people should use the.deferred()
method of an_Event
instead. It's still required internally (to go to/from the ops state) and might be needed in obscure cases, but this reduces the number of ways people need to be aware of by one.scenario.deferred()
helper is removed. When using this method for events that link to components (relations, containers, etc) it was possible to not have the event set up correctly, and it didn't really seem to offer much over.deferred()
. Removing it leaves one normal way to create deferred events.Finally, setting up the
DeferredEvent
snapshot data only handled workload events and relation events (and wasn't always correct for all relation events). It should now cover all current events with the right snapshot.