diff options
author | Ahmad Sherif <me@ahmadsherif.com> | 2016-10-11 15:25:17 +0300 |
---|---|---|
committer | Ahmad Sherif <me@ahmadsherif.com> | 2016-11-18 21:25:45 +0300 |
commit | fd05e26618dd0c123ca476b6f5a3d85f1cfe397a (patch) | |
tree | 39a4ac60382ca7ce8d46e3745ba8a381580d6314 /app/workers/authorized_projects_worker.rb | |
parent | aea8baed3093c513560e9ac5ac0c5c99508d3001 (diff) |
Precalculate user's authorized projects in database
Closes #23150
Diffstat (limited to 'app/workers/authorized_projects_worker.rb')
-rw-r--r-- | app/workers/authorized_projects_worker.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/app/workers/authorized_projects_worker.rb b/app/workers/authorized_projects_worker.rb new file mode 100644 index 00000000000..331727ba9d8 --- /dev/null +++ b/app/workers/authorized_projects_worker.rb @@ -0,0 +1,15 @@ +class AuthorizedProjectsWorker + include Sidekiq::Worker + include DedicatedSidekiqQueue + + def self.bulk_perform_async(args_list) + Sidekiq::Client.push_bulk('class' => self, 'args' => args_list) + end + + def perform(user_id) + user = User.find_by(id: user_id) + return unless user + + user.refresh_authorized_projects + end +end |