Skip to content

Draft: updates endpoint

Vincent Breitmoser requested to merge updates-endpoint into master

This is my take on update manifests, which introduces an endpoint for /vks/v1/updates instead of maintaining a fully static cache. It's built on the manifest and epoch code from !180 (closed)

  1. update log files are written by epoch instead of by day, to avoid complex logic when loading by day
  2. manifests are computed dynamically, by loading all epochs as Vec and k-merging them. for 50 epochs, this takes 200ms on my machine.
  3. the loaded epochs are kept in a simple memory cache once loaded. the same request with all epochs cached takes 20ms on my machine.
  4. responses have an Expires header, which allows nginx to cache all returned update manifests until the end of the epoch

I started writing this to see how it would feel, and I think it turned out very well. The dynamic endpoint is just 80 lines of straightforward code including the cache. Overall, we trade some asymptotic performance here to avoid maintaining dynamic state in the filesystem, and we also retain hagrid's ability to run without an nginx in front.

@teythoon wdyt?

Edited by Vincent Breitmoser

Merge request reports