Add an ability of sorting runners using cached contacted_at values on the "admin/runners" page
Problem to solve
At the moment admin/runners
page gives a chance to chose between 2 ways of sorting:
- Created date
- Last Contact
In fact current Last Contact
option works incorrectly, order of runners is determined by values which are stored in a DB (uncached values). These values are not always up-to-date. There are cached values which are stored in Redis, these values are always up-to-date but at the moment there are no ways of performing sorting of runners using these cached values.
As result there is no way of showing consistent data on the admin/runners
page at the moment. The Last Contact
column can contain either outdated or unsorted data.
Target audience
?
Further details
Using current code base there 2 options of displaying Last Contact
data on admin/runners
page:
- Perform sorting using values from DB but display cached values from Redis. In this case data seems inconsistent in some cases it looks like sorting is not applied at all. This option is used in GitLab 11.6 and in several earlier versions. The problems with this approach are described in the following issue: https://gitlab.com/gitlab-org/gitlab-ce/issues/49791
- Perform sorting using values from DB and display values from DB. In this case data looks visually correct but values are not fully up-to-date, the difference may be up-to tens of minutes. Current proposal was implement as part of the following MR: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/21627
Both approaches have flaws, ideally sorting should be performed using cached values and cached values must be displayed. To implement this approach code base will have to be reworked.
Proposal
Some ideas:
- Track the runner last contacted time in a sorted Redis set
- Flush all the cached runner values to the database if sorting by
Last Contact
is requested
What does success look like, and how can we measure that?
There will be a way of seeing runners properly sorted on the admin/runners
page. Last contact column will show up-to-date values.