Skip to content

Move files/ajax/scan.php to background job - #20545

Merged
DeepDiver1975 merged 1 commit into
masterfrom
scan-storage-in-background-job
Dec 3, 2015
Merged

DeepDiver1975 merged 1 commit into
masterfrom
scan-storage-in-background-job

Conversation

@LukasReschke

Copy link
Copy Markdown
Contributor

The background job will now be executed in chunks of 500 users all 10 minutes.

@DeepDiver1975 @icewind1991 @PVince81 Please review - THX.

Fixes #17906

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@icewind1991 @PVince81 Please advise whether we should use \OC\Files\Utils\Scanner::backgroundScan or \OC\Files\Utils\Scanner::scan here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Especially as this will be run all 10 minutes for a chunk of 500 users. 😉

@karlitschek

Copy link
Copy Markdown
Contributor

looks good. 500 users every 10min sounds reasonable
👍

Comment thread apps/files/appinfo/update.php Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done. THX.

@LukasReschke
LukasReschke force-pushed the scan-storage-in-background-job branch from d8a443b to 5ba2151 Compare November 17, 2015 09:48
@LukasReschke

Copy link
Copy Markdown
Contributor Author

#20545 (comment) is still open

@icewind1991

Copy link
Copy Markdown
Contributor

Add some tests for the iterating over users cases?

  • Offset is at the end of the user list, job should reset offset and query again
  • With >500 users 2 consecutive calls should get a different list of users
  • With <500 users 2 consecutive calls should get the same list of users

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

scan.php uses $scanner->backgroundScan(); which is also what should be used here.

There different is that backgroundScan only checks for folders that are not fully scanned yet (marked with size -1) while scan goes trough the entire filesystem of the user.

Using scan in a backgroundjob in such a naive way will not work when you scale up, when external storages are used scan can easily take many minutes every time you call it, backgroundScan will only take time if there's work to be done

@PVince81

Copy link
Copy Markdown
Contributor

Rebase needed

The background job will now be executed in chunks of 500 users all 10 minutes.
@LukasReschke

Copy link
Copy Markdown
Contributor Author

Rebased also added a new unit test.

  • With >500 users 2 consecutive calls should get a different list of users
  • With <500 users 2 consecutive calls should get the same list of users

@icewind1991 I'm not entirely sure how to do that here considering the mocking and DIs. So what I just added now is a test that it goes back to the first user once it has reached all. If you have an idea on how to test this any help is utmost appreciated.

@MorrisJobke

Copy link
Copy Markdown
Contributor

Tested and works 👍

DeepDiver1975 added a commit that referenced this pull request Dec 3, 2015
Move files/ajax/scan.php to background job
@DeepDiver1975
DeepDiver1975 merged commit 2ceae43 into master Dec 3, 2015
@DeepDiver1975
DeepDiver1975 deleted the scan-storage-in-background-job branch December 3, 2015 15:53
DeepDiver1975 added a commit that referenced this pull request Jan 20, 2016
Remove unneeded markup for scan process - ref #20545
@lock lock Bot locked as resolved and limited conversation to collaborators Aug 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Move ajax/scan.php to cron job

7 participants