Skip to content

feat: Move mimetype repair to background jobs - #39290

Closed
juliusknorr wants to merge 1 commit into
masterfrom
enh/repair-mimetype-job
Closed

feat: Move mimetype repair to background jobs#39290
juliusknorr wants to merge 1 commit into
masterfrom
enh/repair-mimetype-job

Conversation

@juliusknorr

@juliusknorrjuliusknorr commented Jul 10, 2023

Copy link
Copy Markdown
Member

Summary

Move the heavy and slow mime type repair steps into background jobs that are split by storage id.

Some considerations:

  • The query is quite hard to optimize as we need to check for the file extension on all files

  • Running an upgrade without this is usually fine as just old files might not immediately show up with the newly introduced mimetypes then

  • Splitting by storage id seems to be the most reasonable thing to not have massive update transactions, but might not be enough yet

  • Check if this mass of background jobs can become an issue on large instances, maybe those should be only during off-peak hours but this might have the risk of taking forever then

  • Still have a way to manually run them, but we'd need to safeguard to not run the jobs then

Checklist

Signed-off-by: Julius Härtl <jus@bitgrid.net>
/**
* Fix mime types
*/
public function run(IOutput $out) {

Check failure

Code scanning / Psalm

ParamNameMismatch

Argument 1 of OC\Repair\AddRepairMimeTypeJob::run has wrong name $out, expecting $output as defined by OCP\Migration\IRepairStep::run
if (empty($this->folderMimeTypeId)) {
$query->setParameter('mimetype', 'httpd/unix-directory');
$result = $query->execute();
$this->folderMimeTypeId = (int)$result->fetchOne();

Check failure

Code scanning / Psalm

UndefinedThisPropertyAssignment

Instance property OC\Repair\RepairMimeTypeJob::$folderMimeTypeId is not defined
@joshtrichards

Copy link
Copy Markdown
Member

Perhaps incorporate a check (for Admin->Overview) if it's still "in progress" that reports at info-only level. Maybe with some indication of how far along it is so the user can decide whether they need to do something to push it along faster.

@solracsfsolracsf added this to the Nextcloud 28 milestone Jul 13, 2023
@skjnldsvskjnldsv mentioned this pull request Nov 1, 2023
This was referenced Nov 6, 2023
@blizzzblizzz mentioned this pull request Nov 14, 2023
@skjnldsvskjnldsv added the 2. developing Work in progress label Feb 21, 2024
This was referenced Mar 12, 2024
@AltahrimAltahrim mentioned this pull request Mar 20, 2024
@juliusknorr

Copy link
Copy Markdown
MemberAuthor

Replaced by #45930

@skjnldsvskjnldsv removed this from the Nextcloud 30 milestone Aug 14, 2024
@skjnldsv
skjnldsv deleted the enh/repair-mimetype-job branch December 19, 2024 18:04
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2. developingWork in progress

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@juliusknorr@joshtrichards@github-advanced-security@solracsf@skjnldsv