-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Conversation
Check if the batch contains events before trying to access them. Fixes matrix-org#4842
Hello! Before review you'll need to add a changelog entry as per https://github.com/matrix-org/synapse/blob/master/CONTRIBUTING.rst#changelog. Thanks! |
And if the review gives a NACK? The process of
|
@jo-so Fair enough. |
@@ -770,7 +770,7 @@ def compute_state_delta(self, room_id, batch, sync_config, since_token, now_toke | |||
current=current_state_ids, | |||
lazy_load_members=lazy_load_members, | |||
) | |||
elif batch.limited: | |||
elif batch.limited and batch.events: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To me it sounds like the error in #4842 was due to batch.events
being an empty list, rather than None
. In that case, this if
statement would still run and crash.
Instead you may want to check if len(batch.events) > 0
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a Python expert. I found https://stackoverflow.com/questions/53513/how-do-i-check-if-a-list-is-empty
... then you update your PR accordingly.
you might find something like this useful to get the next PR number, so you can create the news file before pushing:
Obviously it assumes you create the PR before any more issues or PRs are opened, but in general it will save time.
There is no need to redo the news file when updating a PR.
I understand that it's not particularly convenient, but ultimately we struggle to handle the number of PRs we get as it is. Anything that contributors can do to make the job easier is much appreciated by us. On which note, please ensure that your PRs contain a link to the bug that they are fixing in the body of the PR description. Github does not link to issues when the issue number is only in the title of the PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please create the changelog file so that the CI runs
I'm not quite sure if this is the right solution. On hold pending further information at #4842 (comment). |
I don't think this change is correct, and as per #4842 it's unclear what we're trying to fix anyway, so I'm going to close this for now. |
Fixes #4842
Pull Request Checklist
Signed-off-by: Jörg Sommer <[email protected]>