-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
fix(caldav): automatically delete outdated scheduling objects #45235
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
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
cbcae93 to
f2d7e9f
Compare
ChristophWurst
left a comment
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.
Let's get rid of the hourly full table scan
👍 otherwise
| ->from('schedulingobjects') | ||
| ->where($query->expr()->lt('lastmodified', $query->createNamedParameter($modifiedBefore))) | ||
| ->setMaxResults($limit); | ||
| $result = $query->executeQuery(); |
Check notice
Code scanning / Psalm
MoreSpecificImplementedParamType
ChristophWurst
left a comment
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.
Code looks good
| ITimeFactory $timeFactory, | ||
| ) { | ||
| parent::__construct($timeFactory); | ||
| $this->setInterval(23 * 60 * 60); |
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.
Why not 24? 😆
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.
@nickvergessen can explain 😉
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.
it would move back all the time, as the run time is not 0 seconds and it can be started with up to 14 minutes delay.
That would mean it would fall further back and back in the "maintenance time window" and eventually skip some day as current time + 24h is outside of maintenance window.
With 23h it will just be saver to run every day.
1a53766 to
6ba43b3
Compare
|
/backport to stable29 |
|
/backport to stable28 |
|
/backport to stable27 |
Signed-off-by: Anna Larch <[email protected]>
6ba43b3 to
ad78f7e
Compare
oc_schedulingobjectsvia cron #43621Summary
oc_schedulingobjects currently grows without ever deleting outdated objects. This PR a repair step that is declared as expensive so admins can decide to run them at their convenience for the initial delete.
The delete is chunked to 50k rows on each transaction so the database isn't locked for a long time (especially in clustered setups this could cause issues). MySQL needs special treatment as it doesn't support LIMITs on DELETE queries, so it does a SELECT on the ids to delete, and then runs the delete on those.
After the repair step has run, a regular cron job is added to the Jobs List that runs every hour to get rid of scheduling objects that are older than an hour. We don't really need them and could theoretically delete them as soon as they're processed by the
ITip\Brokerbut as rooms and resources are also run in a cron job, keeping them until the principal room and resources are added is probably a good idea as I can't exclude unwanted side effects. I also updated the runtime for rooms and resources to run every half hour for that reason.Checklist