Skip to content
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