Skip to content

Commit

Permalink
HSEARCH-4228 Use id as a second key to order events
Browse files Browse the repository at this point in the history
This will mitigate (but not completely solve) the issue of having a low moment time resolution
  • Loading branch information
fax4ever authored and yrodiere committed Jul 22, 2021
1 parent 4e5e0ec commit 136d8ae
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public synchronized List<OutboxEvent> findOutboxEvents(Session session, int maxR
}

Query<OutboxEvent> query = session.createQuery(
"select e from OutboxEvent e where e.id in :ids order by e.moment", OutboxEvent.class );
"select e from OutboxEvent e where e.id in :ids order by e.moment, e.id", OutboxEvent.class );
query.setMaxResults( maxResults );
query.setParameter( "ids", allowedIds );
List<OutboxEvent> returned = query.list();
Expand Down Expand Up @@ -73,7 +73,7 @@ public synchronized void hideAllEvents() {
public List<OutboxEvent> findOutboxEventsNoFilter(Session session) {
checkFiltering();
Query<OutboxEvent> query = session.createQuery(
"select e from OutboxEvent e order by e.moment", OutboxEvent.class );
"select e from OutboxEvent e order by e.moment, e.id", OutboxEvent.class );
return query.list();
}

Expand All @@ -87,7 +87,7 @@ public List<OutboxEvent> findOutboxEventsNoFilterById(Session session) {
public List<Long> findOutboxEventIdsNoFilter(Session session) {
checkFiltering();
Query<Long> query = session.createQuery(
"select e.id from OutboxEvent e order by e.moment", Long.class );
"select e.id from OutboxEvent e order by e.moment, e.id", Long.class );
return query.list();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public final class DefaultOutboxEventFinder implements OutboxEventFinder {
@Override
public List<OutboxEvent> findOutboxEvents(Session session, int maxResults) {
Query<OutboxEvent> query = session.createQuery(
"select e from OutboxEvent e order by e.moment", OutboxEvent.class );
"select e from OutboxEvent e order by e.moment, e.id", OutboxEvent.class );
query.setMaxResults( maxResults );
return query.list();
}
Expand Down

0 comments on commit 136d8ae

Please sign in to comment.