class RailsEventStore::AfterCommitAsyncDispatcher
Public Class Methods
Source
# File lib/rails_event_store/after_commit_async_dispatcher.rb, line 5 def initialize(scheduler:) @scheduler = scheduler end
Public Instance Methods
Source
# File lib/rails_event_store/after_commit_async_dispatcher.rb, line 23 def async_record(schedule_proc) AsyncRecord.new(schedule_proc) end
Source
# File lib/rails_event_store/after_commit_async_dispatcher.rb, line 9 def call(subscriber, _, record) run { @scheduler.call(subscriber, record) } end
Source
# File lib/rails_event_store/after_commit_async_dispatcher.rb, line 13 def run(&schedule_proc) transaction = ActiveRecord::Base.connection.current_transaction if transaction.joinable? transaction.add_record(async_record(schedule_proc)) else yield end end
Source
# File lib/rails_event_store/after_commit_async_dispatcher.rb, line 27 def verify(subscriber) @scheduler.verify(subscriber) end