Skip to content
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

[v1.4] Fix conflict in camera subscriptions #2133

Merged
merged 1 commit into from
Sep 13, 2023

Conversation

JonasVautherin
Copy link
Collaborator

The fact that _status.call_every_cookie is shared between two subscriptions (camera status and camera information) makes them conflict: when unsubscribing from one, it cancels the call_every for both.

Also, depending on the order, it will add_call_every twice with the same cookie, which I believe ends up leaking one.

This PR makes it simpler by requesting the status updates in the plugin directly. I don't think it is worth trying to optimize the number of requests here (and I am pretty sure it ended up doubling them in SiteScan).

@@ -222,6 +225,7 @@ void CameraImpl::manual_disable()
{
invalidate_params();
_parent->remove_call_every(_camera_information_call_every_cookie);
// TODO: should this remove_call_every for _status.call_every_cookie?
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@julianoes: not sure about what manual_disable() does... should it remove_call_every(_status.call_every_cookie) here?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's used when you select another camera. Not sure, I'd probably add it for consistency.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Up to you, otherwise this is fine.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh right, it should otherwise it will leak a callback when manual_enable() is called again 🤔. I'll change that!

@JonasVautherin JonasVautherin force-pushed the 1.4-fix-camera-subscription-conflict branch from e286c36 to 28e3de5 Compare September 8, 2023 19:53
@JonasVautherin JonasVautherin force-pushed the 1.4-fix-camera-subscription-conflict branch from 28e3de5 to 9740dde Compare September 13, 2023 18:05
@julianoes julianoes changed the title Fix conflict in camera subscriptions [v1.4] Fix conflict in camera subscriptions Sep 13, 2023
@julianoes julianoes merged commit 3ee0069 into v1.4 Sep 13, 2023
29 checks passed
@julianoes julianoes deleted the 1.4-fix-camera-subscription-conflict branch September 13, 2023 21:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants