Files
tasks/chasm/lib/scheduler/config.go
zeekay 5a601d081b rebrand: go.temporal.io/server -> github.com/hanzoai/tasks
Full module path rebrand from Temporal to Hanzo Tasks:
- go.mod module: github.com/hanzoai/tasks
- All internal Go imports updated (1906 files)
- cmd/server renamed to cmd/tasksd
- Binary name: tasksd (was temporal-server)
- Docker images: hanzoai/tasks (was temporalio/server)
- README rewritten with Hanzo Tasks branding
- LLM.md created with integration notes
- Makefile, goreleaser, CI workflows updated
- go.temporal.io/sdk and go.temporal.io/api imports preserved (separate repos)

Fork of Temporal.io (MIT license).
2026-03-19 10:36:40 -07:00

79 lines
2.8 KiB
Go

package scheduler
import (
"time"
"github.com/hanzoai/tasks/common/backoff"
"github.com/hanzoai/tasks/common/dynamicconfig"
)
type (
Tweakables struct {
DefaultCatchupWindow time.Duration // Default for catchup window
MinCatchupWindow time.Duration // Minimum for catchup window
MaxBufferSize int // MaxBufferSize limits the number of buffered actions pending execution in total
GeneratorBufferReserveSize int // Minimum number of spaces in `BufferedStarts` reserved for automated actions.
CanceledTerminatedCountAsFailures bool // Whether cancelled+terminated count for pause-on-failure
MaxActionsPerExecution int // Limits the number of actions (startWorkflow, terminate/cancel) taken by ExecuteTask in a single iteration
IdleTime time.Duration // How long to keep schedules after they're done
}
// Config is the CHASM Scheduler dynamic config, shared among all sub-components.
Config struct {
Tweakables dynamicconfig.TypedPropertyFnWithNamespaceFilter[Tweakables]
ServiceCallTimeout dynamicconfig.DurationPropertyFn
RetryPolicy func() backoff.RetryPolicy
}
)
var (
CurrentTweakables = dynamicconfig.NewNamespaceTypedSetting(
"scheduler.tweakables",
DefaultTweakables,
"A set of tweakable parameters for the CHASM scheduler.")
RetryPolicyInitialInterval = dynamicconfig.NewGlobalDurationSetting(
"scheduler.retryPolicy.initialInterval",
time.Second,
`The initial backoff interval when retrying a failed task.`,
)
RetryPolicyMaximumInterval = dynamicconfig.NewGlobalDurationSetting(
"scheduler.retryPolicy.maxInterval",
time.Minute,
`The maximum backoff interval when retrying a failed task.`,
)
ServiceCallTimeout = dynamicconfig.NewGlobalDurationSetting(
"scheduler.serviceCallTimeout",
2*time.Second,
`The upper bound on how long a service call can take before being timed out.`,
)
DefaultTweakables = Tweakables{
DefaultCatchupWindow: 365 * 24 * time.Hour,
MinCatchupWindow: 10 * time.Second,
MaxBufferSize: 1000,
GeneratorBufferReserveSize: 50,
CanceledTerminatedCountAsFailures: false,
MaxActionsPerExecution: 5,
IdleTime: 7 * 24 * time.Hour,
}
)
func ConfigProvider(dc *dynamicconfig.Collection) *Config {
return &Config{
Tweakables: CurrentTweakables.Get(dc),
ServiceCallTimeout: ServiceCallTimeout.Get(dc),
RetryPolicy: func() backoff.RetryPolicy {
return backoff.NewExponentialRetryPolicy(
RetryPolicyInitialInterval.Get(dc)(),
).WithMaximumInterval(
RetryPolicyMaximumInterval.Get(dc)(),
).WithExpirationInterval(
backoff.NoInterval,
)
},
}
}