mirror of
https://github.com/Fishwaldo/huginn.git
synced 2025-03-15 19:31:26 +00:00
Reorder received_events by id asc
The implementation of latest_events() assumed that while it wasn't actually the case; the association of received_events has a default scope of `order(id: :desc)`.
This commit is contained in:
parent
654da6a4e6
commit
63c7ec5fdd
1 changed files with 3 additions and 2 deletions
|
@ -190,6 +190,8 @@ module Agents
|
|||
end
|
||||
|
||||
def latest_events(reload = false)
|
||||
received_events = received_events().reorder(id: :asc)
|
||||
|
||||
events =
|
||||
if (event_ids = memory[:event_ids]) &&
|
||||
memory[:events_order] == events_order &&
|
||||
|
@ -207,8 +209,7 @@ module Agents
|
|||
|
||||
new_events =
|
||||
if last_event_id = memory[:last_event_id]
|
||||
received_events.where(Event.arel_table[:id].gt(last_event_id)).
|
||||
order(id: :asc).to_a
|
||||
received_events.where(Event.arel_table[:id].gt(last_event_id)).to_a
|
||||
else
|
||||
source_ids.flat_map { |source_id|
|
||||
# dig twice as many events as the number of
|
||||
|
|
Loading…
Add table
Reference in a new issue