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
{{ message }}
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
richvdh opened this issue
Nov 18, 2021
· 0 comments
Labels
P3(OBSOLETE: use S- labels.) Approved backlog: not yet scheduled, will accept patchesT-TaskRefactoring, removal, replacement, enabling or disabling functionality, other engineering tasks.
it doesn't consumeErrors by default, which in 99% of cases leads to log spam about unhandled failures
it does some awful __getattr__ / __setattr__ hijinks to "transparently" pass through the methods on the underlying Deferred, which makes it hard to type correctly and generally leads to magical behaviour.
I find it weird that you can fire an ObservableDeferred either by directly calling its callback/errback methods, or by calling them on the deferred you pass into it.
I would like to replace it with a much simpler implementation. Here is a proposal for how we can do it without rewriting everything at once.
Define an abstract base class which ObservableDeferred implements, called AbstractObservableDeferred, which just exposes the observe method:
Replace consumers (rather than creators) of ObservableDeferred with AbstractObservableDeferred
Create a new class SimpleObservableDeferred which implementents AbstractObservableDeferred, and just has a callback, an errback, and an observe method. Both methods should return None.
Replace uses of ObservableDeferred which currently create a brand new Deferred with SimpleObservableDeferred
Create a new class DeferredObserver which wraps a SimpleObservableDeferred:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
P3(OBSOLETE: use S- labels.) Approved backlog: not yet scheduled, will accept patchesT-TaskRefactoring, removal, replacement, enabling or disabling functionality, other engineering tasks.
... and I hate it.
In particular:
consumeErrors
by default, which in 99% of cases leads to log spam about unhandled failures__getattr__
/__setattr__
hijinks to "transparently" pass through the methods on the underlyingDeferred
, which makes it hard to type correctly and generally leads to magical behaviour.ObservableDeferred
either by directly calling itscallback
/errback
methods, or by calling them on the deferred you pass into it.I would like to replace it with a much simpler implementation. Here is a proposal for how we can do it without rewriting everything at once.
ObservableDeferred
implements, calledAbstractObservableDeferred
, which just exposes theobserve
method:ObservableDeferred
withAbstractObservableDeferred
SimpleObservableDeferred
which implemententsAbstractObservableDeferred
, and just has acallback
, anerrback
, and anobserve
method. Both methods should returnNone
.ObservableDeferred
which currently create a brand newDeferred
withSimpleObservableDeferred
DeferredObserver
which wraps aSimpleObservableDeferred
:ObservableDeferred
which chain to an existing Deferred withDeferredObserver
ObservableDeferred
The text was updated successfully, but these errors were encountered: