Skip to content

Commit

Permalink
Merge pull request #4212 from open-horizon/Issue4211
Browse files Browse the repository at this point in the history
Keep agent in sync after startup
  • Loading branch information
LiilyZhang authored Dec 27, 2024
2 parents 209a61b + a71ad27 commit fa0437d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion agreement/agreement.go
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,14 @@ func (w *AgreementWorker) syncOnInit() error {
glog.Errorf(logString(fmt.Sprintf("cannot record agreement %v state %v, error: %v", ag.CurrentAgreementId, state, err)))
}
}
}
} else {
//Setting this as potentially failed enables governAgreements func in governance/governance.go to use the same mechanism as used in heartbeat restored
//to verify the agreement is still valid or else cancels it to keep agent and hub in sync
_, err := persistence.SetFailedVerAttempts(w.db, ag.CurrentAgreementId, ag.AgreementProtocol, ag.FailedVerAttempts+1)
if err != nil {
glog.Errorf(logString(fmt.Sprintf("encountered error updating agreement %v, error %v", ag.CurrentAgreementId, err)))
}
}
glog.V(3).Infof(logString(fmt.Sprintf("added agreement %v to policy agreement counter.", ag.CurrentAgreementId)))
}
}
Expand Down

0 comments on commit fa0437d

Please sign in to comment.