Skip to content

Optimize cleanup job#8421

Open
CarlSchwan wants to merge 2 commits intomainfrom
carl/perf-cron
Open

Optimize cleanup job#8421
CarlSchwan wants to merge 2 commits intomainfrom
carl/perf-cron

Conversation

@CarlSchwan
Copy link
Copy Markdown
Member

@CarlSchwan CarlSchwan commented Apr 1, 2026

📝 Summary

Speedup considerably cleanup cron job.

  1. Fix N+1 issue when trying to find documents without active session
  2. Add an index to optimize getting the latest version of a document (using composite index with DESC, which is required for all databases but mysql/mariadb)

🚧 TODO

  • Fix Migration step 'OCA\Text\Migration\Version080000Date20260331132113' is unknown

🏁 Checklist

  • Code is properly formatted (npm run lint / npm run stylelint / composer run cs:check)
  • Sign-off message is added to all commits
  • Tests (unit, integration and/or end-to-end) passing and the changes are covered with tests
  • Documentation (README or documentation) has been updated or is not required

Do that in one query instead of ending up doing N+1 queries.

Signed-off-by: Carl Schwan <carlschwan@kde.org>
Decrease time to execute the query from 10s of seconds to a few
miliseconds.

Signed-off-by: Carl Schwan <carlschwan@kde.org>
@CarlSchwan CarlSchwan marked this pull request as ready for review April 1, 2026 08:57
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 1, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@blizzz blizzz requested a review from benjaminfrueh April 1, 2026 09:45
@blizzz blizzz added this to the Nextcloud 34 milestone Apr 1, 2026
@blizzz blizzz added bug Something isn't working performance 🚀 labels Apr 1, 2026
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