Commit c291a30d authored by Peter Leitzen's avatar Peter Leitzen

Merge branch 'bvl-add-context-to-pat-expiring-worker' into 'master'

Add context to the ExpiringWorker

See merge request gitlab-org/gitlab!24686
parents ad890526 fbab0f24
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
module PersonalAccessTokens module PersonalAccessTokens
class ExpiringWorker class ExpiringWorker
include ApplicationWorker include ApplicationWorker
include CronjobQueue # rubocop:disable Scalability/CronWorkerContext include CronjobQueue
feature_category :authentication_and_authorization feature_category :authentication_and_authorization
...@@ -12,6 +12,7 @@ module PersonalAccessTokens ...@@ -12,6 +12,7 @@ module PersonalAccessTokens
limit_date = PersonalAccessToken::DAYS_TO_EXPIRE.days.from_now.to_date limit_date = PersonalAccessToken::DAYS_TO_EXPIRE.days.from_now.to_date
User.with_expiring_and_not_notified_personal_access_tokens(limit_date).find_each do |user| User.with_expiring_and_not_notified_personal_access_tokens(limit_date).find_each do |user|
with_context(user: user) do
notification_service.access_token_about_to_expire(user) notification_service.access_token_about_to_expire(user)
Rails.logger.info "#{self.class}: Notifying User #{user.id} about expiring tokens" # rubocop:disable Gitlab/RailsLogger Rails.logger.info "#{self.class}: Notifying User #{user.id} about expiring tokens" # rubocop:disable Gitlab/RailsLogger
...@@ -20,4 +21,5 @@ module PersonalAccessTokens ...@@ -20,4 +21,5 @@ module PersonalAccessTokens
end end
end end
end end
end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment