mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-12-22 01:44:58 -05:00
Test for sentinel commit
This commit is contained in:
parent
1d6dd1c294
commit
3e4272961a
@ -146,13 +146,30 @@ def _check_yield_points(f, changes, start_context):
|
||||
# raise Exception(err)
|
||||
return getattr(e, "value", None)
|
||||
|
||||
frame = gen.gi_frame
|
||||
|
||||
if isinstance(d, defer.Deferred):
|
||||
# This happens if we yield on a deferred that doesn't follow
|
||||
# the log context rules without wrappin in a `make_deferred_yieldable`
|
||||
if LoggingContext.current_context() != LoggingContext.Sentinel:
|
||||
err = (
|
||||
"%s yielded with context %s rather than Sentinel,"
|
||||
" yielded on line %d in %s"
|
||||
% (
|
||||
frame.f_code.co_name,
|
||||
start_context,
|
||||
LoggingContext.current_context(),
|
||||
frame.f_lineno,
|
||||
frame.f_code.co_filename,
|
||||
)
|
||||
)
|
||||
changes.append(err)
|
||||
|
||||
try:
|
||||
result = yield d
|
||||
except Exception as e:
|
||||
result = Failure(e)
|
||||
|
||||
frame = gen.gi_frame
|
||||
|
||||
if LoggingContext.current_context() != expected_context:
|
||||
# This happens because the context is lost sometime *after* the
|
||||
# previous yield and *after* the current yield. E.g. the
|
||||
|
Loading…
Reference in New Issue
Block a user