Skip to content

Conversation

@Geesu
Copy link

@Geesu Geesu commented Apr 12, 2024

The existing implementation of SortedSet asks each new timer to compare to other timers at the time of insertion and then places the object in the tree so it is sorted. Well, the workers gem is calculating the time remaining for a timer, but it never recalculates after the value is inserted into the tree.

This implementation evaluates sec_remaining when it accesses the set, which is required because the order is determined by that value, which changes over time. The previous implementation was not reevaluating these on insert, so the order would become more wrong over time.

Thx to ex-employee Robin for help debugging this weird ness!

@jharbert
Copy link
Member

@Geesu interesting - is this a bug in the Gem that was exposed via Ruby 3 upgrade?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants