This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Fix get federation status of destination if no error occured #11593
Merged
Merged
Changes from 7 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
cf94d17
Fix get federation status of destination if no error occured
dklimpel c2cc7bc
newsfile
dklimpel d07bf85
fix mypy errors
dklimpel 1678729
Merge remote-tracking branch 'synapse/develop' into fed_is_dst
dklimpel 7bee260
Merge remote-tracking branch 'synapse/develop' into fed_is_dst
dklimpel cb61469
suggested changes from the review (docstring, function name, bool)
dklimpel 022751d
Fix typo
dklimpel 7ba12c8
Update 11593.bugfix
dklimpel dad3321
rebuild `response`
dklimpel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Fix an error to get federation status of a destination server even if no error has occurred. | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -111,12 +111,26 @@ async def on_GET( | |
) -> Tuple[int, JsonDict]: | ||
await assert_requester_is_admin(self._auth, request) | ||
|
||
if not await self._store.is_destination_known(destination): | ||
raise NotFoundError("Unknown destination") | ||
|
||
destination_retry_timings = await self._store.get_destination_retry_timings( | ||
destination | ||
) | ||
|
||
if not destination_retry_timings: | ||
raise NotFoundError("Unknown destination") | ||
retry_timing_response: JsonDict = {} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It might be clearer to create the dictionary initially with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Your suggestion is response ( {
"destination": {
"destination": "matrix.org",
"retry_last_ts": 1557332397936,
"retry_interval": 3000000,
"failure_ts": 1557329397936,
"last_successful_stream_ordering": null
}
} instead of: {
"destination": "matrix.org",
"retry_last_ts": 1557332397936,
"retry_interval": 3000000,
"failure_ts": 1557329397936,
"last_successful_stream_ordering": null
} ? This would be different to rooms and users. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, my suggestion is to build the response as: retry_timing_response: JsonDict = {
"destination": destination,
}
retry_timing_response[...] = ... |
||
if destination_retry_timings: | ||
retry_timing_response = { | ||
"failure_ts": destination_retry_timings.failure_ts, | ||
"retry_last_ts": destination_retry_timings.retry_last_ts, | ||
"retry_interval": destination_retry_timings.retry_interval, | ||
} | ||
else: | ||
retry_timing_response = { | ||
"failure_ts": None, | ||
"retry_last_ts": 0, | ||
"retry_interval": 0, | ||
} | ||
|
||
last_successful_stream_ordering = ( | ||
clokep marked this conversation as resolved.
Show resolved
Hide resolved
|
||
await self._store.get_destination_last_successful_stream_ordering( | ||
|
@@ -126,10 +140,8 @@ async def on_GET( | |
|
||
response = { | ||
"destination": destination, | ||
"failure_ts": destination_retry_timings.failure_ts, | ||
"retry_last_ts": destination_retry_timings.retry_last_ts, | ||
"retry_interval": destination_retry_timings.retry_interval, | ||
"last_successful_stream_ordering": last_successful_stream_ordering, | ||
**retry_timing_response, | ||
} | ||
|
||
return HTTPStatus.OK, response |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Can you include when the bug was introduced and note somewhere that this only applies to an admin API? Thanks!