nomad-helper icon indicating copy to clipboard operation
nomad-helper copied to clipboard

refactor: call system gc once instead of after each job cleanup iteration

Open josegonzalez opened this issue 3 years ago • 0 comments

When cleaning up a namespace, we previously:

  • purged the ignorable jobs
  • called system gc
  • called namespace deletion

This was performed for each namespace, causing more load on Nomad as it called GC potentially dozens of times.

Instead, we now purged all the ignorable jobs in each namespace, then call system gc, and finally delete all the underlying namespaces. This should cause less stress on the nomad cluster.

Additionally, if no jobs are found for a deletable namespace, skip the deletion logic completely (which makes the log output a bit cleaner).

josegonzalez avatar Jul 25 '22 20:07 josegonzalez