Class: RailsEventStore::AsyncProxyStrategy::AfterCommit
- Inherits:
-
Object
- Object
- RailsEventStore::AsyncProxyStrategy::AfterCommit
- Defined in:
- lib/rails_event_store/active_job_dispatcher.rb
Defined Under Namespace
Classes: AsyncRecord
Instance Method Summary collapse
Instance Method Details
#call(klass, event) ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/rails_event_store/active_job_dispatcher.rb', line 6 def call(klass, event) if ActiveRecord::Base.connection.transaction_open? ActiveRecord::Base. connection. current_transaction. add_record(AsyncRecord.new(klass, event)) else klass.perform_later(YAML.dump(event)) end end |