@@ -336,7 +336,7 @@ func (c *ConfigFileFlow) mainLoop(ctx context.Context) {
336336 changedConfigFile .GetFileName ())
337337
338338 newNotifiedVersion := changedConfigFile .GetVersion ()
339- oldNotifiedVersion := c .getConfigFileNotifiedVersion (cacheKey )
339+ oldNotifiedVersion := c .getConfigFileNotifiedVersion (cacheKey , true )
340340
341341 maxVersion := oldNotifiedVersion
342342 if newNotifiedVersion > oldNotifiedVersion {
@@ -382,7 +382,7 @@ func (c *ConfigFileFlow) assembleWatchConfigFiles() []*configconnector.ConfigFil
382382 Namespace : configFileMetadata .GetNamespace (),
383383 FileGroup : configFileMetadata .GetFileGroup (),
384384 FileName : configFileMetadata .GetFileName (),
385- Version : c .getConfigFileNotifiedVersion (cacheKey ),
385+ Version : c .getConfigFileNotifiedVersion (cacheKey , false ),
386386 })
387387 }
388388
@@ -395,9 +395,11 @@ func (c *ConfigFileFlow) updateNotifiedVersion(cacheKey string, version uint64)
395395 c .notifiedVersion [cacheKey ] = version
396396}
397397
398- func (c * ConfigFileFlow ) getConfigFileNotifiedVersion (cacheKey string ) uint64 {
399- c .fclock .RLock ()
400- defer c .fclock .RUnlock ()
398+ func (c * ConfigFileFlow ) getConfigFileNotifiedVersion (cacheKey string , locking bool ) uint64 {
399+ if locking {
400+ c .fclock .RLock ()
401+ defer c .fclock .RUnlock ()
402+ }
401403 version , ok := c .notifiedVersion [cacheKey ]
402404 if ! ok {
403405 version = initVersion
0 commit comments