You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In AMP, there are two kinds of invocations of callRemote: the normal one, where you get a Deferred back and then you have to handle the error from it, and fire-and-forget, where you specify requiresAnswer = False and you get None back, and you don't care if that specific invocation failed.
The distinction is semantically important because unhandled errors on Deferreds get logged, which means if you do this:
#!py
class MyNeatCommand(Command):
requiresAnswer = False
...
self.callRemote(MyNeatCommand)
you can't know a-priori whether the connection is closed or not, so you need this nasty workaround instead:
#!py
result = self.callRemote(MyNeatCommand)
if result is not None:
result.addErrback(lambda ignored: None)
unless you want your logs to fill up with unexplained ConnectionDone errors.
Instead, BoxDispatcher._sendBoxCommand ought to check requiresAnswerbefore it checks _failAllReason, and never return a failing Deferred when none is expected.
In AMP, there are two kinds of invocations of
callRemote
: the normal one, where you get aDeferred
back and then you have to handle the error from it, and fire-and-forget, where you specifyrequiresAnswer = False
and you getNone
back, and you don't care if that specific invocation failed.The distinction is semantically important because unhandled errors on Deferreds get logged, which means if you do this:
you can't know a-priori whether the connection is closed or not, so you need this nasty workaround instead:
unless you want your logs to fill up with unexplained
ConnectionDone
errors.Instead,
BoxDispatcher._sendBoxCommand
ought to checkrequiresAnswer
before it checks_failAllReason
, and never return a failingDeferred
when none is expected.Searchable metadata
The text was updated successfully, but these errors were encountered: