mirror of
https://github.com/ditkrg/outboxable.git
synced 2026-01-22 22:06:47 +00:00
Adds initial 10 seconds as last_attempted_at so that it is not picked again by polling publisher
This commit is contained in:
parent
02bd4dcc00
commit
cf5f49691f
@ -10,15 +10,13 @@ class Outbox < ApplicationRecord
|
|||||||
enum size: { single: 0, batch: 1 }
|
enum size: { single: 0, batch: 1 }
|
||||||
|
|
||||||
# Validations
|
# Validations
|
||||||
validates :payload, presence: true
|
validates :payload, :exchange, :routing_key, presence: true
|
||||||
validates :exchange, presence: true
|
|
||||||
validates :routing_key, presence: true
|
|
||||||
|
|
||||||
# Associations
|
# Associations
|
||||||
belongs_to :outboxable, polymorphic: true, optional: true
|
belongs_to :outboxable, polymorphic: true, optional: true
|
||||||
|
|
||||||
def set_last_attempted_at
|
def set_last_attempted_at
|
||||||
self.last_attempted_at = Time.zone.now
|
self.last_attempted_at = 10.seconds.from_now
|
||||||
end
|
end
|
||||||
|
|
||||||
def publish
|
def publish
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user