diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2017-01-19 19:58:37 +0100 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2017-01-21 13:30:17 +0100 |
commit | 0e755df25cc283baf7ebd38a767bbf50d0ae1a08 (patch) | |
tree | 35162756df2297719e41e8a95cda273e6bc426ad /spec/models/user_spec.rb | |
parent | 1bb0191a8a5302448bd0ebdbeaf5a3113723193d (diff) | |
download | gitlab-ce-refresh-authorizations-without-sidekiq.tar.gz |
Stop using Sidekiq for authorized projectsrefresh-authorizations-without-sidekiq
Instead of using Sidekiq we now reset the column
users.authorized_projects_populated whenever authorizations have to be
refreshed. The next time the data is requested User#authorized_projects
will automatically refresh the data before returning it. When refreshing
data for single users we refresh the data right away.
This should solve any race conditions that may occur due to the
scheduling taking place in a transaction. It also simplifies the setup
by removing Sidekiq. This does come at the cost of some requests being a
bit slower whenever data has to be refreshed. This however should occur
only when authorizations have been changed, a process that thankfully
does not happen very often.
Diffstat (limited to 'spec/models/user_spec.rb')
-rw-r--r-- | spec/models/user_spec.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 8b20ee81614..d8a1c5c81d2 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -1144,9 +1144,13 @@ describe User, models: true do user = create(:user) member = group.add_developer(user) + user.reload + expect(user.authorized_projects).to include(project) member.destroy + user.reload + expect(user.authorized_projects).not_to include(project) end |