As @dtzWill discovered, with the concurrent hydra-evaluator, there can be multiple active transactions adding builds to the database. As a result, builds can become visible in a non-monotonically increasing order, breaking the queue monitor's assumption that build IDs only go up.
The fix is to have hydra-eval-jobset provide the lowest build ID it just added in the builds_added notification, and have the queue monitor check from there.
Fixes #496.
S2NXJOJE3V7PTXHA2HAHA5BUSNJRHZNXBWK7KSWTPGISWKXYMJDQC
OG3Z3QGCG2FNDGF4VQYWOXLZCF7LGTZCUMGKUCBNAPAQ5FRFHQ2AC
H4KMCXGUC5MA7AZUN33GQQWCP66UP7T6IYGJB6HY5AUSKVS32YZAC
MHVIT4JYWUYD4UCGB2AHLXWLX6B5SYE22BREERNGANT7RGGDUFOAC
HJOEIMLRDVQ2KZI5HGL2HKGBM3AHP7YIKGKDAGFUNKRUXVRB24NAC
TJK27WSBFOM6LKVCSA7LTTCWUGB4O2AL22PNIDQXS4BFOFCISH2QC
WQXF2T3DFC2K72OVX46TUQ4IMZNJ5BSBQ7L7AVI7QL54DXCBEKLQC
N22GPKYTOLZLBGTGDATQDVZ4R5APZEAOIA7L32X4UXBH4XNI7MWAC
DDGBLKEN6VLDOV7LPG5PHYHWO7EYCCSFHVLGLB52CZV3USX2IQ6QC
DDMYFZ5XWW6O3TGCVNW4GPVR2ZPRFWIPQU54DCVUYARFXIMKENUQC
RVHBV3B3RA3QTPQFCTICFFG5QGRUZ7EGXZNR4W2MOM2HPBHPZV7AC
D5QIOJGPKQJIYBUCSC3MFJ3TXLPNZ2XMI37GXMFRVRFWWR2VMTFAC
drop trigger BuildsAdded on Builds;
drop function notifyBuildsAdded();