phase1,phase2: improve round robin builds
There seems to be some issue with database updates, where database
updates are asynchronous and thus the status update of the previous
build (complete_at DB column) might take little bit longer, then
preparation of the next/current build.
This is issue during job prioritization as this might result in the
build of the same builder twice in a row, for example:
2021-06-22 02:42:54+0000 [-] <Build mipsel_24kc number:95 results:success>: build finished
2021-06-22 02:42:55+0000 [-] prioritizeBuilders: mipsel_24kc complete_at: 2021-06-21 20:17:14+00:00
2021-06-22 03:14:30+0000 [-] prioritizeBuilders: mipsel_24kc complete_at: 2021-06-22 02:42:54+00:00
Build finishes at 02:42:54, scheduler then asks for next build at
02:42:55, but the build still has the old complete_at timestamp
2021-06-21 20:17:14 instead of the correct one 2021-06-22 02:42:54, thus
scheduling the build of oldest mipsel_24kc builder one more time.
This is so far very promising workaround attempt which checks latest
builder complete_at in builds table which seems to be updated faster,
thus using greater complete_at value seems to work for now.
References: https://github.com/buildbot/buildbot/issues/4592#issuecomment-
801163587
Signed-off-by: Petr Štetiar <ynezz@true.cz>