synapse
federation/send_queue.py: fix usage of sortedcontainers.SortedDict
#3348
Merged

federation/send_queue.py: fix usage of sortedcontainers.SortedDict #3348

intelfx
intelfx6 years ago

Fix fallout from f7869f8.

Also I do not understand why we add 1 to right (closing) indices.

j = keys.bisect_right(to_token) + 1

This makes us always include one entry past to_token, even if it exists:

>>> sd = SortedDict({ 1: 'a', 2: 'b', 3: 'c', 4: 'd', 6: 'f', 7: 'g', 8: 'h', 9: 'i', 11: 'k' })
>>> sd.items()[sd.bisect_right(1):sd.bisect_right(6)+1]
[(2, 'b'), (3, 'c'), (4, 'd'), (6, 'f'), (7, 'g')]
>>> sd.items()[sd.bisect_right(1):sd.bisect_right(5)+1]
[(2, 'b'), (3, 'c'), (4, 'd'), (6, 'f')]

It is not obvious if such behavior is correct or not.

matrixbot
matrixbot6 years ago

Can one of the admins verify this patch?

matrixbot
matrixbot6 years ago

Can one of the admins verify this patch?

intelfx intelfx force pushed 6 years ago
intelfx federation/send_queue.py: fix usage of sortedcontainers.SortedDict
c88d50aa
intelfx intelfx force pushed to c88d50aa 6 years ago
hawkowl
hawkowl6 years ago

matrixbot: test this please

hawkowl hawkowl merged d8db6d92 into develop 6 years ago
ara4n
ara4n6 years ago

@hawkowl what is the story on the + 1 question?

Login to write a write a comment.

Login via GitHub

Reviewers
No reviews
Assignees
No one assigned
Labels
Milestone