mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-05-31 04:30:44 +00:00
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:
+4
-4
@@ -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()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user