ccutrer / openhab-jrubyscripting

JRuby Libraries for Openhab
Eclipse Public License 2.0
1 stars 1 forks source link

fix reentrant timer #53

Closed jimtng closed 1 year ago

jimtng commented 1 year ago

Timer#cancel shouldn't be called from inside a compute block because it deletes the timer id from the map being computed

Once it's deleted, the timer is no longer re-entrant, and multiple timers will be created.

On the second call to after, the timer id will be deleted from timers object. Although the first timer gets cancelled, the second timer is no longer kept track of. On the third call, a new timer is created whilst the second timer remains active, thus violating the reentrancy.

ccutrer commented 1 year ago

Can you write spec(s) for this?

jimtng commented 1 year ago

spec added