Skip to content

Conversation

@ronething
Copy link
Contributor

Type of change:

  • Bugfix
  • New feature provided
  • Improve performance
  • Backport patches
  • Documentation
  • Refactor
  • Chore
  • CI/CD or Tests

What this PR does / why we need it:

In the Start function of adc client, we have already implemented the matter of timed synchronization, and there is no need to open a new go func for the same processing.

ref:

func (d *adcClient) Start(ctx context.Context) error {
initalSyncDelay := d.InitSyncDelay
time.AfterFunc(initalSyncDelay, func() {
if err := d.Sync(ctx); err != nil {
log.Error(err)
return
}
})
if d.SyncPeriod < 1 {
return nil
}
ticker := time.NewTicker(d.SyncPeriod)
defer ticker.Stop()
for {
select {
case <-ticker.C:
if err := d.Sync(ctx); err != nil {
log.Error(err)
}
case <-ctx.Done():
return nil
}
}
}

Pre-submission checklist:

  • Did you explain what problem does this PR solve? Or what new features have been added?
  • Have you added corresponding test cases?
  • Have you modified the corresponding document?
  • Is this PR backward compatible? If it is not backward compatible, please discuss on the mailing list first

@ronething ronething requested review from AlinsRan and nic-6443 July 16, 2025 03:07
@ronething ronething merged commit 1156414 into master Jul 17, 2025
23 checks passed
@ronething ronething deleted the fix/remove_duplicate_func branch July 17, 2025 02:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants