From f7b38769a913a530b41ccd074d0e39ccf39f1ab9 Mon Sep 17 00:00:00 2001 From: Nikolay Edigaryev Date: Tue, 5 Nov 2024 00:01:14 +0100 Subject: [PATCH] tart pull: open the VM directory after pulling under a lock (#936) --- Sources/tart/Commands/Pull.swift | 3 --- Sources/tart/VMStorageOCI.swift | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Sources/tart/Commands/Pull.swift b/Sources/tart/Commands/Pull.swift index d14bc9b..02c5e29 100644 --- a/Sources/tart/Commands/Pull.swift +++ b/Sources/tart/Commands/Pull.swift @@ -47,8 +47,5 @@ struct Pull: AsyncParsableCommand { defaultLogger.appendNewLine("pulling \(remoteName)...") try await VMStorageOCI().pull(remoteName, registry: registry, concurrency: concurrency, deduplicate: deduplicate) - - // to explicitly set the image as being accessed so it won't get pruned immediately - _ = try VMStorageOCI().open(remoteName) } } diff --git a/Sources/tart/VMStorageOCI.swift b/Sources/tart/VMStorageOCI.swift index 71009fa..86896d4 100644 --- a/Sources/tart/VMStorageOCI.swift +++ b/Sources/tart/VMStorageOCI.swift @@ -239,6 +239,9 @@ class VMStorageOCI: PrunableStorage { // are excluded from garbage collection VMDirectory(baseURL: vmURL(name)).markExplicitlyPulled() } + + // to explicitly set the image as being accessed so it won't get pruned immediately + _ = try VMStorageOCI().open(name) } func linked(from: RemoteName, to: RemoteName) -> Bool {