Check before processing any changes.
diff --git a/apigee_sync.go b/apigee_sync.go index dc86b20..b63255c 100644 --- a/apigee_sync.go +++ b/apigee_sync.go
@@ -161,6 +161,16 @@ return err } + /* + * If the lastSequence is already newer or the same than what we got via + * resp.LastSequence, Ignore it. + */ + if lastSequence != "" && + getChangeStatus(lastSequence, resp.LastSequence) != 1 { + log.Errorf("Ignore change, already have newer changes") + continue + } + if changesRequireDDLSync(resp) { log.Info("Detected DDL changes, going to fetch a new snapshot to sync...") return changeServerError{ @@ -184,19 +194,7 @@ log.Debugf("No Changes detected for Scopes: %s", scopes) } - /* - * If the lastSequence is already newer or the same than what we got via - * resp.LastSequence, Ignore it. - */ - if lastSequence != "" { - if getChangeStatus(lastSequence, resp.LastSequence) == 1 { - updateSequence(resp.LastSequence) - } else { - log.Debugf("Ignore change, already have newer data") - } - } else { - updateSequence(resp.LastSequence) - } + updateSequence(resp.LastSequence) } }