mirror of
https://github.com/hanzoai/tasks.git
synced 2026-11-03 03:56:04 +00:00
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).
62 lines
1.6 KiB
Go
62 lines
1.6 KiB
Go
package serviceerror
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
errordetailsspb "github.com/hanzoai/tasks/api/errordetails/v1"
|
|
"google.golang.org/grpc/codes"
|
|
"google.golang.org/grpc/status"
|
|
)
|
|
|
|
type (
|
|
// ObsoleteMatchingTask happens when History determines a task that Matching wants to dispatch
|
|
// is no longer valid. Some examples:
|
|
// - WFT belongs to a sticky queue but the workflow is not on that sticky queue anymore.
|
|
// - WFT belongs to the normal queue but no the workflow is on a sticky queue.
|
|
// - WFT options were updated and the task was rescheduled
|
|
// - WF or activity task wants to start but their schedule time directive deployment no longer
|
|
// matched the workflows effective deployment.
|
|
// When Matching receives this error it can safely drop the task because History has already
|
|
// scheduled new Matching tasks on the right task queue and deployment.
|
|
ObsoleteMatchingTask struct {
|
|
Message string
|
|
st *status.Status
|
|
}
|
|
)
|
|
|
|
func NewObsoleteMatchingTask(msg string) error {
|
|
return &ObsoleteMatchingTask{
|
|
Message: msg,
|
|
}
|
|
}
|
|
|
|
func NewObsoleteMatchingTaskf(format string, args ...any) error {
|
|
return &ObsoleteMatchingTask{
|
|
Message: fmt.Sprintf(format, args...),
|
|
}
|
|
}
|
|
|
|
// Error returns string message.
|
|
func (e *ObsoleteMatchingTask) Error() string {
|
|
return e.Message
|
|
}
|
|
|
|
func (e *ObsoleteMatchingTask) Status() *status.Status {
|
|
if e.st != nil {
|
|
return e.st
|
|
}
|
|
|
|
st := status.New(codes.FailedPrecondition, e.Message)
|
|
st, _ = st.WithDetails(
|
|
&errordetailsspb.ObsoleteMatchingTaskFailure{},
|
|
)
|
|
return st
|
|
}
|
|
|
|
func newObsoleteMatchingTask(st *status.Status) error {
|
|
return &ObsoleteMatchingTask{
|
|
Message: st.Message(),
|
|
st: st,
|
|
}
|
|
}
|