Sha256: 32dd660d78d1de821a66099595bbdbdb2ede65ed20299a89fc3e9d593da9dabf
Contents?: true
Size: 738 Bytes
Versions: 19
Compression:
Stored size: 738 Bytes
Contents
# frozen_string_literal: true module AcidicJob class IdempotencyKey def initialize(job) @job = job end def value(acidic_by: :job_id) case acidic_by when Proc proc_result = @job.instance_exec(&acidic_by) Digest::SHA1.hexdigest [@job.class.name, proc_result].flatten.join when :job_arguments Digest::SHA1.hexdigest [@job.class.name, @job.arguments].flatten.join else if @job.job_id.start_with? Run::STAGED_JOB_ID_PREFIX # "STG__#{idempotency_key}__#{encoded_global_id}" _prefix, idempotency_key, _encoded_global_id = @job.job_id.split("__") idempotency_key else @job.job_id end end end end end
Version data entries
19 entries across 19 versions & 1 rubygems