mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-08-21 02:18:14 -04:00
Improve exception handling for concurrent execution (#12109)
* fix incorrect unwrapFirstError import this was being imported from the wrong place * Refactor `concurrently_execute` to use `yieldable_gather_results` * Improve exception handling in `yieldable_gather_results` Try to avoid swallowing so many stack traces. * mark unwrapFirstError deprecated * changelog
This commit is contained in:
parent
952efd0bca
commit
9d11fee8f2
5 changed files with 151 additions and 27 deletions
|
@ -81,7 +81,9 @@ json_decoder = json.JSONDecoder(parse_constant=_reject_invalid_json)
|
|||
|
||||
|
||||
def unwrapFirstError(failure: Failure) -> Failure:
|
||||
# defer.gatherResults and DeferredLists wrap failures.
|
||||
# Deprecated: you probably just want to catch defer.FirstError and reraise
|
||||
# the subFailure's value, which will do a better job of preserving stacktraces.
|
||||
# (actually, you probably want to use yieldable_gather_results anyway)
|
||||
failure.trap(defer.FirstError)
|
||||
return failure.value.subFailure # type: ignore[union-attr] # Issue in Twisted's annotations
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue