mirror of
https://github.com/hanzoai/tasks.git
synced 2026-10-30 14:56:19 +00:00
## What changed? Add new rate limiter priority to support high/low replication tier ## Why? high replication tier has higher priority than the low replication tier. The task processing part is separated. This change allow us throttled low replication tier first. ## How did you test it? - [x] built - [ ] run locally and tested manually - [ ] covered by existing tests - [ ] added new unit test(s) - [ ] added new functional test(s)
59 lines
1023 B
Go
59 lines
1023 B
Go
package replication
|
|
|
|
import (
|
|
"time"
|
|
|
|
"go.temporal.io/server/common/metrics"
|
|
ctasks "go.temporal.io/server/common/tasks"
|
|
)
|
|
|
|
type (
|
|
ExecutableNoopTask struct {
|
|
ExecutableTask
|
|
}
|
|
)
|
|
|
|
const (
|
|
noopTaskID = "noop-task-id"
|
|
)
|
|
|
|
var _ ctasks.Task = (*ExecutableNoopTask)(nil)
|
|
var _ TrackableExecutableTask = (*ExecutableNoopTask)(nil)
|
|
|
|
func NewExecutableNoopTask(
|
|
processToolBox ProcessToolBox,
|
|
taskID int64,
|
|
taskCreationTime time.Time,
|
|
sourceClusterName string,
|
|
sourceShardKey ClusterShardKey,
|
|
) *ExecutableNoopTask {
|
|
return &ExecutableNoopTask{
|
|
ExecutableTask: NewExecutableTask(
|
|
processToolBox,
|
|
taskID,
|
|
metrics.NoopTaskScope,
|
|
taskCreationTime,
|
|
time.Now().UTC(),
|
|
sourceClusterName,
|
|
sourceShardKey,
|
|
nil,
|
|
),
|
|
}
|
|
}
|
|
|
|
func (e *ExecutableNoopTask) QueueID() interface{} {
|
|
return noopTaskID
|
|
}
|
|
|
|
func (e *ExecutableNoopTask) Execute() error {
|
|
return nil
|
|
}
|
|
|
|
func (e *ExecutableNoopTask) HandleErr(err error) error {
|
|
return err
|
|
}
|
|
|
|
func (e *ExecutableNoopTask) MarkPoisonPill() error {
|
|
return nil
|
|
}
|