Content
Updated by Pavel Balashou about 2 months ago
:warning: This concerns the synchronization of AMPF enabled Projects and Storages.
### What does the synchronization job does:
A **lot** of stuff, namely:
1. Creates Project Folder if it isn't there
2. Renames the folder if the need be
3. Removes access to the folder for all archived projects
4. Ensure that OpenProject admins, that have accessed the storage, have access to all folders
5. Remove permissions from users that lost access to that project
6. Add permissions to users that have been added to the project
All this is run for every `Storage` with `automatically_managed_folders_enabled` defined on the following occasions:
1. Every 60 mins (CronJob)
2. On Member
1. Create
2. Update
3. Destroyed (poor member)
3. On Project:
1. Updated
2. Renamed
3. Archived
4. Unarchived
4. On OAuthClientToken
1. Created
5. On Role:
1. Update
2. Destroyed
6. On storage:
1. Created
2. Updated
3. Destroyed
We have some debouncing going on to deal with this, but still it is a lot of triggers for a fairly expensive jobs.
### Proposal
We can first, break down the monolithic service into its parts, for example:
1. `CreateManagedFolderService`
2. `RenameManagedFolderService`
3. `HideManagedFolderService`
4. `AddUserToManagedFolderService`
5. `RemoveUserFromManagedFolderService`
The current implementation can then make use of those for its operations (maybe?)
Create new jobs for each of these and hook those to the events.
Once they are into place we can reduce the long expensive one to, let's say once every couple of hours or less.
DONE ALREADY:
Secondly we can break down the job on per storage basis:
1\. One job == One storage synchronization. synchronization.
2\. Then on top of this job we have one to synchronize all storages.
3\. On each event we schedule synchronization of only involved storages.
### Next steps
Review it and identify next simplification steps.
### What does the synchronization job does:
A **lot** of stuff, namely:
1. Creates Project Folder if it isn't there
1. Every 60 mins (CronJob)
### Proposal
We can first, break down the monolithic service into its parts, for example:
1. `CreateManagedFolderService`
Create new jobs for each of these and hook those to the events.
Once they are into place we can reduce the long expensive one to, let's say once every couple of hours or less.
DONE ALREADY:
1\. One job == One storage synchronization.
2\. Then on top of this job we have one to synchronize all storages.
3\. On each event we schedule synchronization of only involved storages.
### Next steps
Review it and identify next simplification steps.