Fixed race condition: Scheduler job pushes outdated data to the client.
This commit is contained in:
parent
20ea94d34b
commit
a70153106a
1 changed files with 3 additions and 11 deletions
|
@ -3,19 +3,11 @@ module ChecksLatestChangeObserved
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
included do
|
included do
|
||||||
after_create :latest_change_set_from_observer
|
after_commit :latest_change_set_from_observer
|
||||||
after_update :latest_change_set_from_observer
|
|
||||||
after_touch :latest_change_set_from_observer
|
|
||||||
after_destroy :latest_change_set_from_observer_destroy
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def latest_change_set_from_observer
|
def latest_change_set_from_observer
|
||||||
self.class.latest_change_set(updated_at)
|
latest_change = destroyed? ? nil : updated_at
|
||||||
true
|
self.class.latest_change_set(latest_change)
|
||||||
end
|
|
||||||
|
|
||||||
def latest_change_set_from_observer_destroy
|
|
||||||
self.class.latest_change_set(nil)
|
|
||||||
true
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue