The query that finds the streams with events that a consumer has not processed yet, and that it can claim now: not
claimed by another instance (or the claim expired), and not waiting for the retry of a failed event.
It reads the rows of the consumer in hermes_subscriptions in the order of the primary key, from after on, and
joins every stream by its primary key, so it needs no sort, and its cost grows with the number of streams that the
consumer knows. The caller moves after past the streams it got and wraps around at the end, so busy streams at the
beginning of the key order do not starve the others.
The query that finds the streams with events that a consumer has not processed yet, and that it can claim now: not claimed by another instance (or the claim expired), and not waiting for the retry of a failed event.
It reads the rows of the consumer in
hermes_subscriptionsin the order of the primary key, fromafteron, and joins every stream by its primary key, so it needs no sort, and its cost grows with the number of streams that the consumer knows. The caller movesafterpast the streams it got and wraps around at the end, so busy streams at the beginning of the key order do not starve the others.