Class: Users::TrackNamespaceVisitsWorker
- Inherits:
-
Object
- Object
- Users::TrackNamespaceVisitsWorker
- Includes:
- ApplicationWorker
- Defined in:
- app/workers/users/track_namespace_visits_worker.rb
Constant Summary collapse
- GROUPS =
'groups'
- PROJECTS =
'projects'
Constants included from ApplicationWorker
ApplicationWorker::LOGGING_EXTRA_KEY, ApplicationWorker::SAFE_PUSH_BULK_LIMIT
Constants included from Gitlab::Loggable
Constants included from WorkerAttributes
WorkerAttributes::DEFAULT_DATA_CONSISTENCY, WorkerAttributes::DEFAULT_DEFER_DELAY, WorkerAttributes::NAMESPACE_WEIGHTS, WorkerAttributes::VALID_DATA_CONSISTENCIES, WorkerAttributes::VALID_RESOURCE_BOUNDARIES, WorkerAttributes::VALID_URGENCIES
Instance Method Summary collapse
Methods included from Gitlab::Loggable
Methods included from Gitlab::SidekiqVersioning::Worker
Methods included from WorkerContext
Instance Method Details
#perform(entity_type, entity_id, user_id, time) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'app/workers/users/track_namespace_visits_worker.rb', line 15 def perform(entity_type, entity_id, user_id, time) return unless entity_id && user_id case entity_type when GROUPS unless GroupVisit.visited_around?(entity_id: entity_id, user_id: user_id, time: time) GroupVisit.create!(entity_id: entity_id, user_id: user_id, visited_at: time) end when PROJECTS unless ProjectVisit.visited_around?(entity_id: entity_id, user_id: user_id, time: time) ProjectVisit.create!(entity_id: entity_id, user_id: user_id, visited_at: time) end end end |