summaryrefslogtreecommitdiff
path: root/app/workers/authorized_projects_worker.rb
Commit message (Collapse)AuthorAgeFilesLines
* Smarter refreshing of authorized projectsproject-authorizations-diffYorick Peterse2016-12-191-21/+1
| | | | | | | | | | | | | | | | | | | | | Prior to this commit the refreshing of authorized projects was done in two steps: 1. Remove existing authorizations 2. Insert a new list of all authorizations This can lead to a high amount of dead tuples as every time all rows are being replaced. For example, if a user with 100 authorizations is given access to a new project this would lead to: * 100 rows being removed * 101 new rows being inserted This commit changes the way this system works so it only removes/inserts what is necessary. Using the above example this would lead to only 1 new row being inserted, with the initial 100 being left untouched. Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/25257
* Refresh project authorizations using a Redis leaserefresh-authorizations-with-leaseYorick Peterse2016-11-251-2/+21
| | | | | | | | | | | | | | | | | When I proposed using serializable transactions I was hoping we would be able to refresh data of individual users concurrently. Unfortunately upon closer inspection it was revealed this was not the case. This could result in a lot of queries failing due to serialization errors, overloading the database in the process (given enough workers trying to update the target table). To work around this we're now using a Redis lease that is cancelled upon completion. This ensures we can update the data of different users concurrently without overloading the database. The code will try to obtain the lease until it succeeds, waiting at least 1 second between retries. This is necessary as we may otherwise end up _not_ updating the data which is not an option.
* Precalculate user's authorized projects in databaseAhmad Sherif2016-11-181-0/+15
Closes #23150