11156: Fix infinite loop condition.
[arvados.git] / sdk / go / dispatch / dispatch.go
index 5d85c1bdfd0dbb77d09d94c0695ac6c7451e3e62..4b22c6302345f3fe8eca18d0beb42b4b341dc441 100644 (file)
@@ -130,7 +130,7 @@ func (d *Dispatcher) checkForUpdates(filters [][]interface{}) {
                        log.Printf("Error getting list of containers: %q", err)
                        return
                }
-               more = list.ItemsAvailable > len(list.Items)
+               more = len(list.Items) > 0 && list.ItemsAvailable > len(list.Items)+offset
                d.checkListForUpdates(list.Items)
        }
 }
@@ -174,7 +174,7 @@ func (d *Dispatcher) checkListForUpdates(containers []arvados.Container) {
                                }
                                d.trackers[c.UUID] = d.start(c)
                        case Cancelled, Complete:
-                               tracker.close()
+                               // no-op (we already stopped monitoring)
                        }
                }
        }