@@ -147,6 +147,7 @@ func (g *SynchronizerServer) GenesisSync(ctx context.Context, request *agent.Gen
147
147
}
148
148
vtap := fmt .Sprintf ("%d-%d" , orgID , vtapID )
149
149
150
+ var refresh bool
150
151
var localVersion uint64 = 0
151
152
if vtapID == 0 {
152
153
log .Infof ("genesis sync received message with vtap_id 0 from %s" , remote , logger .NewORGPrefix (orgID ))
@@ -160,9 +161,11 @@ func (g *SynchronizerServer) GenesisSync(ctx context.Context, request *agent.Gen
160
161
} else {
161
162
agingTime = g .cfg .VinterfaceAgingTime
162
163
}
163
- if now .Sub (lastTime ).Seconds () >= agingTime {
164
+ timeSub := now .Sub (lastTime ).Seconds ()
165
+ if timeSub >= agingTime {
164
166
g .vtapToVersion .Store (vtap , uint64 (0 ))
165
167
}
168
+ refresh = timeSub >= g .cfg .AgentHeartBeat * 2
166
169
}
167
170
g .vtapToLastSeen .Store (vtap , now )
168
171
lVersion , ok := g .vtapToVersion .Load (vtap )
@@ -176,12 +179,13 @@ func (g *SynchronizerServer) GenesisSync(ctx context.Context, request *agent.Gen
176
179
log .Debugf ("genesis sync renew version %v from ip %s vtap_id %v" , version , remote , vtapID , logger .NewORGPrefix (orgID ))
177
180
g .genesisSyncQueue .Put (
178
181
common.VIFRPCMessage {
179
- Peer : remote ,
180
- VtapID : vtapID ,
181
- ORGID : orgID ,
182
- TeamID : uint32 (teamID ),
183
- MessageType : common .TYPE_RENEW ,
184
- Message : request ,
182
+ Peer : remote ,
183
+ VtapID : vtapID ,
184
+ ORGID : orgID ,
185
+ TeamID : uint32 (teamID ),
186
+ MessageType : common .TYPE_RENEW ,
187
+ Message : request ,
188
+ StorageRefresh : refresh ,
185
189
},
186
190
)
187
191
return & agent.GenesisSyncResponse {Version : & localVersion }, nil
0 commit comments