mirror of
https://github.com/hanzoai/tasks.git
synced 2026-10-04 02:04:03 +00:00
## What changed?
<!-- Describe what has changed in this PR -->
Remove license header from every file. Because it is really hard to
follow in this PR here is the summary:
1. License header is removed from all `.go` and `.proto` files
:fireworks::fireworks:🎆.
2. `LICENSE` file in the root directory has only Temporal and Uber
copyrights.
3. 5 other `LICENSE` files added to the packages which have copyrights
different from Temporal and Uber: Datadog, Xargin, "Mat Ryer, Tyler
Bunnell and contributors".
4. `license_file` flag is removed from all code generation tools.
5. `copyright_file` flag is removed from `go:generate mockgen`
directive.
6. All copyright related targets are removed from `Makefile`.
7. Updated Temporal copyright year to 2025 everywhere.
## Why?
<!-- Tell your future self why have you made these changes -->
I double checked with legal department that it is not needed to have
license header in every file. One file per repo is enough. I put all
copyrights to the root `LICENSE` file and removed header from all other
files. Also updated tools and `Makefile`.
79 lines
2.7 KiB
Go
79 lines
2.7 KiB
Go
package scheduler
|
|
|
|
import (
|
|
"time"
|
|
|
|
"go.temporal.io/server/common/backoff"
|
|
"go.temporal.io/server/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
|
|
CanceledTerminatedCountAsFailures bool // Whether cancelled+terminated count for pause-on-failure
|
|
RecentActionCount int // Number of recent actions taken (workflow execution results) recorded in the ScheduleInfo metadata.
|
|
MaxActionsPerExecution int // Limits the number of actions (startWorkflow, terminate/cancel) taken by ExecuteTask in a single iteration
|
|
|
|
// TODO - incomplete tweakables list
|
|
}
|
|
|
|
// State Machine Scheduler dynamic config, shared among all sub state machines.
|
|
Config struct {
|
|
Tweakables dynamicconfig.TypedPropertyFnWithNamespaceFilter[Tweakables]
|
|
ServiceCallTimeout dynamicconfig.DurationPropertyFn
|
|
RetryPolicy func() backoff.RetryPolicy
|
|
}
|
|
)
|
|
|
|
var (
|
|
CurrentTweakables = dynamicconfig.NewNamespaceTypedSetting(
|
|
"component.scheduler.tweakables",
|
|
DefaultTweakables,
|
|
"A set of tweakable parameters for the state machine scheduler.")
|
|
|
|
RetryPolicyInitialInterval = dynamicconfig.NewGlobalDurationSetting(
|
|
"component.scheduler.retryPolicy.initialInterval",
|
|
time.Second,
|
|
`The initial backoff interval when retrying a failed workflow start.`,
|
|
)
|
|
|
|
RetryPolicyMaximumInterval = dynamicconfig.NewGlobalDurationSetting(
|
|
"component.scheduler.retryPolicy.maxInterval",
|
|
time.Minute,
|
|
`The maximum backoff interval when retrying a failed workflow start.`,
|
|
)
|
|
|
|
ServiceCallTimeout = dynamicconfig.NewGlobalDurationSetting(
|
|
"component.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,
|
|
CanceledTerminatedCountAsFailures: false,
|
|
RecentActionCount: 10,
|
|
MaxActionsPerExecution: 10,
|
|
}
|
|
)
|
|
|
|
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,
|
|
)
|
|
},
|
|
}
|
|
}
|