tart pull: open the VM directory after pulling under a lock (#936)

This commit is contained in:
Nikolay Edigaryev 2024-11-05 00:01:14 +01:00 committed by GitHub
parent 7c1ed4640f
commit f7b38769a9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View File

@ -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)
}
}

View File

@ -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 {