Skip to content

Commit

Permalink
tart pull: open the VM directory after pulling under a lock (#936)
Browse files Browse the repository at this point in the history
  • Loading branch information
edigaryev authored Nov 4, 2024
1 parent 7c1ed46 commit f7b3876
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 0 additions & 3 deletions Sources/tart/Commands/Pull.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
3 changes: 3 additions & 0 deletions Sources/tart/VMStorageOCI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit f7b3876

Please sign in to comment.