publish: fix locking of snapshots

snapshots come in 3 kinds: local, remote and snapshot

find resources to be locked for each kind, recursively for the snapshot kind
This commit is contained in:
André Roth
2026-05-04 23:56:01 +02:00
parent 4defa49b7f
commit 5ff552d919
3 changed files with 288 additions and 52 deletions
+4 -4
View File
@@ -65,7 +65,7 @@ func (list *List) consumer() {
task.State = SUCCEEDED
}
fmt.Printf("RACE DEBUG: Task %s done, freeing %s\n", task.Name, task.resources)
fmt.Printf("RACE DEBUG: Task Done '%s', freeing %s\n", task.Name, task.resources)
list.usedResources.Free(task.resources)
task.wgTask.Done()
@@ -79,7 +79,7 @@ func (list *List) consumer() {
if len(blockingTasks) == 0 {
list.usedResources.MarkInUse(t.resources, t)
fmt.Printf("RACE DEBUG: Starting queued task %s, using %s\n", t.Name, t.resources)
fmt.Printf("RACE DEBUG: Task Resuming '%s', locking %s\n", t.Name, t.resources)
// unlock list since queueing may block
list.Unlock()
unlocked = true
@@ -212,12 +212,12 @@ func (list *List) RunTaskInBackground(name string, resources []string, process P
tasks := list.usedResources.UsedBy(resources)
if len(tasks) == 0 {
list.usedResources.MarkInUse(task.resources, task)
fmt.Printf("RACE DEBUG: Starting task %s, using %s\n", name, resources)
fmt.Printf("RACE DEBUG: Task Starting '%s', locking %s\n", name, resources)
// queueing task might block if channel not ready, unlock list before queueing
list.Unlock()
list.queue <- task
} else {
fmt.Printf("RACE DEBUG: Queued task %s, locked %s\n", name, resources)
fmt.Printf("RACE DEBUG: Task Queued '%s', waiting on %s\n", name, resources)
list.Unlock()
}