mirror of
https://github.com/hanzoai/tasks.git
synced 2026-10-30 14:56:19 +00:00
## What changed? - Use archetypeID everywhere in history service and pass them to persistence ## Why? - Required for separate ID space work. ## How did you test it? - [x] built - [ ] run locally and tested manually - [x] covered by existing tests - [x] added new unit test(s) - [ ] added new functional test(s)
44 lines
1020 B
Go
44 lines
1020 B
Go
package refreshworkflow
|
|
|
|
import (
|
|
"context"
|
|
|
|
"go.temporal.io/server/chasm"
|
|
"go.temporal.io/server/common/definition"
|
|
"go.temporal.io/server/common/locks"
|
|
"go.temporal.io/server/common/namespace"
|
|
"go.temporal.io/server/service/history/api"
|
|
historyi "go.temporal.io/server/service/history/interfaces"
|
|
)
|
|
|
|
func Invoke(
|
|
ctx context.Context,
|
|
workflowKey definition.WorkflowKey,
|
|
archetypeID chasm.ArchetypeID,
|
|
shardContext historyi.ShardContext,
|
|
workflowConsistencyChecker api.WorkflowConsistencyChecker,
|
|
) (retError error) {
|
|
err := api.ValidateNamespaceUUID(namespace.ID(workflowKey.NamespaceID))
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
if archetypeID == chasm.UnspecifiedArchetypeID {
|
|
archetypeID = chasm.WorkflowArchetypeID
|
|
}
|
|
|
|
chasmLease, err := workflowConsistencyChecker.GetChasmLease(
|
|
ctx,
|
|
nil,
|
|
workflowKey,
|
|
archetypeID,
|
|
locks.PriorityLow,
|
|
)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
defer func() { chasmLease.GetReleaseFn()(retError) }()
|
|
|
|
return chasmLease.GetContext().RefreshTasks(ctx, shardContext)
|
|
}
|