Sha256: f1f975b0aa6485127fe67cdf1a96972e3f4c105d7a9b53328f1da6043f1f5d28
Contents?: true
Size: 1.21 KB
Versions: 3
Compression:
Stored size: 1.21 KB
Contents
# frozen_string_literal: true module AcidicJob module PerformWrapper def perform(*args, **kwargs) # extract the `staged_job_gid` if present # so that we can later delete the record in an `after_perform` callback final_arg = args.last if final_arg.is_a?(Hash) && final_arg.key?("staged_job_gid") args = args[0..-2] @staged_job_gid = final_arg["staged_job_gid"] end set_arguments_for_perform(*args, **kwargs) super(*args, **kwargs) end private # rubocop:disable Metrics/AbcSize def set_arguments_for_perform(*args, **kwargs) # store arguments passed into `perform` so that we can later persist # them to `AcidicJob::Key#job_args` for both ActiveJob and Sidekiq::Worker @arguments_for_perform = if args.any? && kwargs.any? args + [kwargs] elsif args.any? && kwargs.none? args elsif args.none? && kwargs.any? [kwargs] else [] end end # rubocop:enable Metrics/AbcSize end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
acidic_job-0.7.2 | lib/acidic_job/perform_wrapper.rb |
acidic_job-0.7.1 | lib/acidic_job/perform_wrapper.rb |
acidic_job-0.7.0 | lib/acidic_job/perform_wrapper.rb |