func (d *Deployment) watchCurrentVersion() error { currentVersion := d.currentVersion() lastWaitIndex := uint64(0) for range util.NotShutdown() { newCurrentVersion, newWaitIndex, err := d.fetchCurrentVersion(lastWaitIndex) if err != nil { return err } lastWaitIndex = newWaitIndex d.diffCurrentVersion(currentVersion, newCurrentVersion) currentVersion = newCurrentVersion } return nil }
func (d *Deployment) watchVersions() error { versions := []string{} lastWaitIndex := uint64(0) for range util.NotShutdown() { newVersions, nextWaitIndex, err := d.fetchVersions(lastWaitIndex) if err != nil { return err } d.diffVersions(versions, newVersions) versions = newVersions lastWaitIndex = nextWaitIndex } return nil }