Sha256: d076ea3944dc4842f74eecc07b85d7d573e5df77dd47c2dc06a9c8d3894a3339

Contents?: true

Size: 430 Bytes

Versions: 1

Compression:

Stored size: 430 Bytes

Contents

module Workarea
  class SynchronizeUserMetrics
    include Sidekiq::Worker
    include Sidekiq::CallbacksWorker

    sidekiq_options(
      enqueue_on: { User => :save, only_if: -> { admin_changed? || tags_changed? } },
      queue: 'low'
    )

    def perform(id)
      user = User.find(id)
      metrics = Metrics::User.find_or_create_by(id: user.email)
      metrics.set(admin: user.admin?, tags: user.tags)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
workarea-core-3.5.0.beta.1 app/workers/workarea/synchronize_user_metrics.rb