Sha256: 23b478f0eb6aadb0f565fc9bc8d2e75078b15704200b0c50241863f850fea66d
Contents?: true
Size: 1 KB
Versions: 8
Compression:
Stored size: 1 KB
Contents
module Gorynich module Head module ActiveJob extend ::ActiveSupport::Concern included do attr_reader :current_uri, :current_tenant def serialize super.merge(uri: Gorynich::Current.uri, tenant: Gorynich::Current.tenant) end def deserialize(job_data) super @current_uri = job_data.fetch(:uri) @current_tenant = job_data.fetch(:tenant) end def retry_job(**_options) Gorynich.with(current_tenant, uri: current_uri) do |_current| super end end around_perform do |job, block| Gorynich.with( job.current_tenant || Gorynich::Current.tenant, uri: job.current_uri || Gorynich::Current.uri ) do |_current| block.call end end around_enqueue do |_job, block| Gorynich.with_database(Gorynich.instance.default) do block.call end end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems