mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-21 06:09:39 +08:00
vpcagent: apihelper: use CopyJoined()
This commit is contained in:
@@ -82,7 +82,7 @@ func (h *APIHelper) run(ctx context.Context) {
|
||||
log.Errorln(err)
|
||||
}
|
||||
if changed {
|
||||
mssCopy := h.modelSets.Copy()
|
||||
mssCopy := h.modelSets.CopyJoined()
|
||||
select {
|
||||
case h.modelSetsCh <- mssCopy:
|
||||
case <-ctx.Done():
|
||||
@@ -100,10 +100,12 @@ func (h *APIHelper) doSync(ctx context.Context) (changed bool, err error) {
|
||||
}
|
||||
|
||||
s := h.adminClientSession(ctx)
|
||||
r, err := SyncModelSets(h.modelSets, s, h.opts.ListBatchSize)
|
||||
mss := h.modelSets.Copy()
|
||||
r, err := SyncModelSets(mss, s, h.opts.ListBatchSize)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
h.modelSets = mss
|
||||
if !r.Correct {
|
||||
return false, errors.Wrap(ErrSync, "incorrect")
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ type IModelSets interface {
|
||||
ModelSetList() []IModelSet
|
||||
ApplyUpdates(IModelSets) ModelSetsUpdateResult
|
||||
Copy() IModelSets
|
||||
CopyJoined() IModelSets
|
||||
}
|
||||
|
||||
type IModelSet interface {
|
||||
|
||||
Reference in New Issue
Block a user