Class: PersonalAccessTokens::ExpiringWorker
- Inherits:
-
Object
- Object
- PersonalAccessTokens::ExpiringWorker
- Includes:
- ApplicationWorker, CronjobQueue, Gitlab::Utils::StrongMemoize
- Defined in:
- app/workers/personal_access_tokens/expiring_worker.rb
Overview
rubocop:disable Scalability/IdempotentWorker
Constant Summary collapse
- MAX_TOKENS =
100- MAX_RUNTIME =
3.minutes
- REQUEUE_DELAY =
2.minutes
- BATCH_SIZE =
For the worker is timing out with a bigger batch size gitlab.com/gitlab-org/gitlab/-/issues/432518
100
Constants included from ApplicationWorker
ApplicationWorker::LOGGING_EXTRA_KEY, ApplicationWorker::SAFE_PUSH_BULK_LIMIT
Constants included from Gitlab::Loggable
Constants included from WorkerAttributes
WorkerAttributes::DEFAULT_CONCURRENCY_LIMIT_PERCENTAGE_BY_URGENCY, WorkerAttributes::DEFAULT_DATA_CONSISTENCY, WorkerAttributes::DEFAULT_DATA_CONSISTENCY_PER_DB, WorkerAttributes::DEFAULT_DEFER_DELAY, WorkerAttributes::LOAD_BALANCED_DATA_CONSISTENCIES, WorkerAttributes::NAMESPACE_WEIGHTS, WorkerAttributes::VALID_DATA_CONSISTENCIES, WorkerAttributes::VALID_RESOURCE_BOUNDARIES, WorkerAttributes::VALID_URGENCIES
Class Method Summary collapse
-
.batch_size ⇒ Object
allows easier stubbing in specs.
Instance Method Summary collapse
Methods included from Gitlab::Loggable
Methods included from Gitlab::SidekiqVersioning::Worker
Methods included from WorkerContext
Class Method Details
.batch_size ⇒ Object
allows easier stubbing in specs
23 24 25 |
# File 'app/workers/personal_access_tokens/expiring_worker.rb', line 23 def self.batch_size BATCH_SIZE end |
Instance Method Details
#perform(*args) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'app/workers/personal_access_tokens/expiring_worker.rb', line 27 def perform(*args) @runtime_limiter = Gitlab::Metrics::RuntimeLimiter.new(MAX_RUNTIME) notification_intervals.each do |interval| process_user_tokens(interval) break if over_time? process_project_bot_tokens(interval) break if over_time? end self.class.perform_in(REQUEUE_DELAY, *args) if over_time? end |