Skip to content

Commit 203e483

Browse files
committed
Early-out the transfer queue when there's nothing to do
1 parent 16dab09 commit 203e483

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

lfs/transfer_queue.go

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,25 @@ func (q *TransferQueue) processBatch() error {
168168
return nil
169169
}
170170

171+
func (q *TransferQueue) endProcess() {
172+
close(q.errorc)
173+
for _, watcher := range q.watchers {
174+
close(watcher)
175+
}
176+
}
177+
171178
// Process starts the transfer queue and displays a progress bar. Process will
172179
// do individual or batch transfers depending on the Config.BatchTransfer() value.
173180
// Process will transfer files sequentially or concurrently depending on the
174181
// Concig.ConcurrentTransfers() value.
175182
func (q *TransferQueue) Process() {
183+
184+
// Early out if nothing to do
185+
if len(q.transferables) == 0 {
186+
q.endProcess()
187+
return
188+
}
189+
176190
q.bar = pb.New64(q.size)
177191
q.bar.SetUnits(pb.U_BYTES)
178192
q.bar.ShowBar = false
@@ -263,10 +277,7 @@ func (q *TransferQueue) Process() {
263277
}
264278

265279
q.wg.Wait()
266-
close(q.errorc)
267-
for _, watcher := range q.watchers {
268-
close(watcher)
269-
}
280+
q.endProcess()
270281
close(progressc)
271282

272283
q.bar.Finish()

0 commit comments

Comments
 (0)