-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
An ObservableResource is not notified about observation canceling #30
Comments
@chrysn |
Removal of observations generally happens via the cancellation callback passed to the ServerObservation's accept method; this allows an observation to be properly cancelled (pending bugs like this one, when cancellation_callback is probably not properly called, haven't looked properly yet), even when for example it has changed its path in the meantime. (Not a situation I'd expect to be common, but possible for kind of dynamic resources.) When add_obsevation is called, eg. on a Site, the ServerObservation is passed around until it gets accepted by a resource object, and I'm in favor of establishing the relationship to that object at accept time instead of hoping that a parallel cancel_observation would find its way to the very object the add_observation found, however likely it is in most cases. Do you have a suggestion on how to fix this bug that would be made easier if there were a cancel_observation? |
What i am actually trying to do is to establish a producer for an observation, which is to be notified via cancel_observation (server-side cancellation, not self-triggered) to not produce the notifications anymore (by using asyncio loop, my producer just reschedules itself periodically). With no expectation of corner cases here i am currently not aware of, i would try a naive approach of looking up the |
You may close the issue, if you think that such a callback is not necessary. |
I see now what you are aiming for (the resource implementation needs to know when it is being observed, eg. to establish a fnotify); in light of that, my previous answer was not exactly to point. To give me some leeway in how to implement observations, I try to keep the ServerObservation objects out of the ObservableResource as far as possible; a |
Yes, this is exactly what i am looking for. |
Thank you 👍 |
I've noticed that a RST message which is supposed to cancel an existing observation, does nothing on
ObservableResource
. Is there no handler for that to inform the application about the observation cancelation? I think this is also related to issue #13.The text was updated successfully, but these errors were encountered: