Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter out jobs in progress when pruning Db_store #115

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from
Draft
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/db_store.ml
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,15 @@ module Make (Raw : S.STORE) = struct
Raw.delete t.raw id >|= fun () ->
Dao.delete t.dao id
in
aux id
if Builds.mem id t.in_progress then begin
Log.warn (fun f -> f "Trying to delete ID %S but it is still in progress!" id);
Lwt.return_unit (* Ignore the deletion if the job is still in progress *)
end else
aux id

let prune_batch ?(log=ignore) t ~before limit =
let items = Dao.lru t.dao ~before limit in
let items = List.filter (fun id -> not (Builds.mem id t.in_progress)) items in
let n = List.length items in
Log.info (fun f -> f "Pruning %d items (of %d requested)" n limit);
items |> Lwt_list.iter_s (fun id ->
Expand Down