Skip to content

Commit

Permalink
DATA-2665 Change max thread check to handle empty value from config (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
vijayvuyyuru authored and 10zingpd committed May 30, 2024
1 parent 1bfdbb4 commit 38e7652
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions services/datamanager/builtin/builtin.go
Original file line number Diff line number Diff line change
Expand Up @@ -427,8 +427,13 @@ func (svc *builtIn) Reconfigure(
if err != nil {
return err
}

// Syncer should be reinitialized if the max sync threads are updated in the config
reinitSyncer := cloudConnSvc != svc.cloudConnSvc || svcConfig.MaximumNumSyncThreads != svc.maxSyncThreads
newMaxSyncThreadValue := datasync.MaxParallelSyncRoutines
if svcConfig.MaximumNumSyncThreads != 0 {
newMaxSyncThreadValue = svcConfig.MaximumNumSyncThreads
}
reinitSyncer := cloudConnSvc != svc.cloudConnSvc || newMaxSyncThreadValue != svc.maxSyncThreads
svc.cloudConnSvc = cloudConnSvc

captureConfigs, err := svc.updateDataCaptureConfigs(deps, conf, svcConfig.CaptureDir)
Expand Down Expand Up @@ -556,18 +561,14 @@ func (svc *builtIn) Reconfigure(

syncConfigUpdated := svc.syncDisabled != svcConfig.ScheduledSyncDisabled || svc.syncIntervalMins != svcConfig.SyncIntervalMins ||
!reflect.DeepEqual(svc.tags, svcConfig.Tags) || svc.fileLastModifiedMillis != fileLastModifiedMillis ||
svc.maxSyncThreads != svcConfig.MaximumNumSyncThreads
svc.maxSyncThreads != newMaxSyncThreadValue

if syncConfigUpdated {
svc.syncDisabled = svcConfig.ScheduledSyncDisabled
svc.syncIntervalMins = svcConfig.SyncIntervalMins
svc.tags = svcConfig.Tags
svc.fileLastModifiedMillis = fileLastModifiedMillis
maxThreads := datasync.MaxParallelSyncRoutines
if svcConfig.MaximumNumSyncThreads != 0 {
maxThreads = svcConfig.MaximumNumSyncThreads
}
svc.maxSyncThreads = maxThreads
svc.maxSyncThreads = newMaxSyncThreadValue

svc.cancelSyncScheduler()
if !svc.syncDisabled && svc.syncIntervalMins != 0.0 {
Expand Down

0 comments on commit 38e7652

Please sign in to comment.