Skip to content

Commit c8eeca6

Browse files
committed
condition added to verify datafile revision.
1 parent 4457b50 commit c8eeca6

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

optimizely/config/polling_manager.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,17 @@ func (cm *PollingProjectConfigManager) SyncConfig(datafile []byte) {
7070
cmLogger.Error("failed to create project config", err)
7171
}
7272

73-
// TODO: Compare revision numbers here and set projectConfig only if the revision number has changed
7473
cm.configLock.Lock()
75-
cm.projectConfig = projectConfig
74+
if cm.projectConfig != nil {
75+
if cm.projectConfig.GetRevision() == projectConfig.GetRevision() {
76+
cmLogger.Debug(fmt.Sprintf("No datafile updates. Current revision number: %s", cm.projectConfig.GetRevision()))
77+
} else {
78+
cmLogger.Debug(fmt.Sprintf("Received new datafile and updated config. Old revision number: %s. New revision number: %s", cm.projectConfig.GetRevision(), projectConfig.GetRevision()))
79+
cm.projectConfig = projectConfig
80+
}
81+
} else {
82+
cm.projectConfig = projectConfig
83+
}
7684
cm.err = err
7785
cm.configLock.Unlock()
7886
}

0 commit comments

Comments
 (0)