Skip to content
This repository has been archived by the owner on Dec 13, 2023. It is now read-only.

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

Merged
merged 1 commit into from Jun 6, 2018

Conversation

intelfx
Copy link
Contributor

@intelfx intelfx commented Jun 5, 2018

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
Copy link
Member

Can one of the admins verify this patch?

1 similar comment
@matrixbot
Copy link
Member

Can one of the admins verify this patch?

@hawkowl
Copy link
Contributor

hawkowl commented Jun 6, 2018

matrixbot: test this please

@hawkowl hawkowl merged commit d8db6d9 into matrix-org:develop Jun 6, 2018
@ara4n
Copy link
Member

ara4n commented Jun 6, 2018

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants