Skip to content

repos: Reduce CPU usage of Scheduler.PrioritiseUncloned

Warren Gifford requested to merge ts/reduce-cpu-usage-in-prioritise-uncloned into main

Created by: tsenart

As seen in the Datadog profiler, this accounts for a large chunk of the CPU usage over the last two days.

image

There's no reason to loop over all repo updates in the priority queue which is a huge number compared to the set of uncloned repos.

Instead we loop over the uncloned repos, updating the priority of existing updates in the queue and inserting a new update if one doesn't yet exist.

Test plan

Existing tests.

Merge request reports

Loading