-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
fix: pause child monitors if parent is paused #5193
base: master
Are you sure you want to change the base?
fix: pause child monitors if parent is paused #5193
Conversation
There seems to be another bug. |
Not sure if its a good solution, but its fixed. |
I've reverted the fix to this bug, because I found some more problems regarding this and moved it to MR #5196. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic seems a bit slow as it includes a lot of steps that all happen in a series.
We should be able to merge this into one one database query or at least a significantly more sane amount than 3 (you are currently missing setting the active
field for children) per child recursively.
What about a recursive CTE instead?
WITH RECURSIVE monitor_ids_to_pause(id) as (
SELECT m.id
FROM monitor m
WHERE m.id = ? AND m.active = true
UNION
SELECT m.id
FROM monitor_ids_to_pause r, monitor m
WHERE m.parent = r.id AND m.active = true
)
SELECT * FROM monitor_ids_to_pause;
The call to Monitor.stop()
should also be in a Promise.all(..)
to make sure that this adding the async code there does not cause a performance problem.
I improved the efficiency of database queries in multiple locations concerning groups and recursion. Please take a moment to review these changes to ensure they meet your expectations and do not introduce any new bugs.
I implemented these changes for both Monitor.start() and Monitor.stop(). However, I'm not sure if it should be used in Monitor.start(), considering the comment in startMonitors().
I don't believe that the active field should be set for child monitors, as the isParentActive method is specifically designed for this purpose. Using this method ensures that the activity status is correctly determined based on the parent monitor, maintaining the intended functionality. |
https://github.com/louislam/uptime-kuma/blob/master/CONTRIBUTING.md#can-i-create-a-pull-request-for-uptime-kuma
Tick the checkbox if you understand [x]:
Description
Currently if a group is paused, the children will be shown as paused, but they are not. I fixed this behavior.
Also shows groups as pending if all childs are paused (idea from #4663).
Fixes #4696
Type of change
Please delete any options that are not relevant.
Checklist
Screenshots (if any)
Please do not use any external image service. Instead, just paste in or drag and drop the image here, and it will be uploaded automatically.