Skip to content

Instantly share code, notes, and snippets.

@alexxty7
Last active April 19, 2019 08:48
Show Gist options
  • Save alexxty7/0e09aa870e586d8785788d628746e7dd to your computer and use it in GitHub Desktop.
Save alexxty7/0e09aa870e586d8785788d628746e7dd to your computer and use it in GitHub Desktop.
# Macro::Queue(Api::V1::Clients::Bookings::Operation::CreateChat, args: [:booking])
module Macro
def self.Queue(constant, args:)
task = lambda { |(ctx, flow_options), **|
StepWorker.perform_async(constant, ctx.slice(*args))
[Trailblazer::Activity::Left, [ctx, flow_options]]
}
{ task: task, id: constant.class_name }
end
class StepWorker
include Sidekiq::Worker
def perform(constant, args)
constant.call(args)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment