fix monitoring daily dispatch cap
This commit is contained in:
@@ -344,18 +344,8 @@ func shutdownSchedulerMetricsServer(server *http.Server, logger interface {
|
||||
}
|
||||
|
||||
func monitoringDailyRunOptions(jobCtx internalscheduler.JobRunContext) tenantapp.MonitoringDailyTaskRunOptions {
|
||||
maxDesktopDispatch := 0
|
||||
if jobCtx.Job != nil && jobCtx.Job.BatchSize != nil {
|
||||
maxDesktopDispatch = *jobCtx.Job.BatchSize
|
||||
}
|
||||
if maxDesktopDispatch <= 0 {
|
||||
maxDesktopDispatch = internalscheduler.AsInt(jobCtx.Config, "max_desktop_dispatch_per_run", 0)
|
||||
}
|
||||
if maxDesktopDispatch <= 0 {
|
||||
maxDesktopDispatch = internalscheduler.AsInt(jobCtx.Config, "batch_size", 0)
|
||||
}
|
||||
return tenantapp.MonitoringDailyTaskRunOptions{
|
||||
MaxDesktopDispatchPerRun: maxDesktopDispatch,
|
||||
MaxDesktopDispatchPerRun: internalscheduler.AsInt(jobCtx.Config, "max_desktop_dispatch_per_run", 0),
|
||||
MaxDesktopClientBacklog: internalscheduler.AsInt(jobCtx.Config, "max_desktop_client_backlog", 0),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ func TestSchedulerMetricsAuthMiddleware(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestMonitoringDailyRunOptionsUsesJobBatchSizeForDesktopDispatchOnly(t *testing.T) {
|
||||
func TestMonitoringDailyRunOptionsIgnoresJobBatchSizeForDailyCollection(t *testing.T) {
|
||||
batchSize := 88
|
||||
got := monitoringDailyRunOptions(internalscheduler.JobRunContext{
|
||||
Job: &opsdomain.SchedulerJob{BatchSize: &batchSize},
|
||||
@@ -68,11 +68,12 @@ func TestMonitoringDailyRunOptionsUsesJobBatchSizeForDesktopDispatchOnly(t *test
|
||||
"max_materialize_per_plan": 12,
|
||||
"max_materialize_per_brand": 4,
|
||||
"max_desktop_client_backlog": 6,
|
||||
"batch_size": 77,
|
||||
},
|
||||
})
|
||||
|
||||
if got.MaxDesktopDispatchPerRun != 88 {
|
||||
t.Fatalf("MaxDesktopDispatchPerRun = %d, want 88", got.MaxDesktopDispatchPerRun)
|
||||
if got.MaxDesktopDispatchPerRun != 0 {
|
||||
t.Fatalf("MaxDesktopDispatchPerRun = %d, want unlimited", got.MaxDesktopDispatchPerRun)
|
||||
}
|
||||
if got.MaxMaterializePerPlan != 0 || got.MaxMaterializePerBrand != 0 {
|
||||
t.Fatalf("legacy plan/brand throttles should be ignored: %#v", got)
|
||||
|
||||
Reference in New Issue
Block a user