-
Notifications
You must be signed in to change notification settings - Fork 489
Description
If a handler is registered to an event
And the requested frequency is different from the requested frequency of an existing handler on that event
And there is state kept between invocations of the event triggering code
Then a handler can miss events that it should receive
An example is manageNewUnitActiveEvent at
dfhack/library/modules/EventManager.cpp
Line 608 in 07e96a6
| static void manageNewUnitActiveEvent(color_ostream& out) { |
It will check for new units and send events to handlers whose "cool down" timer has expired. Handlers that have had an event fire too recently (according to their freq value) will not get an event fired. This is working as intended.
However, when manageNewUnitActiveEvent finishes looping through the handlers, it marks all currently active units as processed. Therefore, the handlers that were not sent an event for the detected new units will never get an event for those units.
In order to continue to support different freq values for different handlers, this issue will need to be solved. Otherwise, we should revert back to the previous behavior of all handlers effectively having the lowest requested freq value.