Skip to content

Chunk OC\User\BackgroundJobs\CleanupDeletedUsers #51048

Open
@Antreesy

Description

@Antreesy

How to use GitHub

  • Please use the 👍 reaction to show that you are interested into the same feature.
  • Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
  • Subscribe to receive notifications on status change and new comments.

Is your feature request related to a problem? Please describe.
In case of a huge amount of deleted users that needs to be cleaned up (e.g. global failure during user backend switch), this background job might be extremely slow to execute, as it tries to handle all records at once consequently.
https://github.com/nextcloud/server/blob/master/lib/private/User/BackgroundJobs/CleanupDeletedUsers.php

Describe the solution you'd like
Allowing this job to chunk records (e.g. 1.000 per time) should not affect small instances (as this amount would be unreachable), but for other cases could be useful to split the load (and maybe run chunks in parallel, if it's possible to give some offset to it)

Describe alternatives you've considered
An additional part might be to track deleting state of user (in case of external storages connected it might take a while, so parallel jobs might take this state in consideration and skip the user, as another job is already working on it).

  • get a user from the list of deleted ("core, deleted, true")
  • mark it as processing (like "core, deleted.state, 'deleting'")
  • in case of a new failure - set to ("core, deleted.state, 'failed'") to log or process later
  • on parallel jobs: check if backend still has the user or they're processed currently
  • make sure the record stays in db with a defined state until finishing

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions