mirror of
https://github.com/hanzoai/tasks.git
synced 2026-10-30 14:56:19 +00:00
## What changed? Add a dedicated DeleteChasmExecution RPC to the history service for deleting CHASM executions by namespace, execution key, and archetype ID. Uses the CHASM engine's DeleteExecution path (terminate-if-running + async DeleteExecutionTask), replacing the ForceDeleteWorkflowExecution workaround in the delete namespace activity which bypassed the engine. Also adds NewComponentRefByArchetypeID to chasm/ref.go to construct a ComponentRef from a runtime archetype ID without a compile-time type parameter. ## Why? Remove dependency on force deletion API. ## How did you test it? - [X] built - [X] run locally and tested manually - [X] covered by existing tests - [X] added new unit test(s) - [X] added new functional test(s)
31 lines
854 B
Go
31 lines
854 B
Go
package deleteexecution
|
|
|
|
import (
|
|
"context"
|
|
|
|
"go.temporal.io/server/api/historyservice/v1"
|
|
"go.temporal.io/server/chasm"
|
|
)
|
|
|
|
func Invoke(
|
|
ctx context.Context,
|
|
chasmEngine chasm.Engine,
|
|
request *historyservice.DeleteExecutionRequest,
|
|
) (*historyservice.DeleteExecutionResponse, error) {
|
|
key := chasm.ExecutionKey{
|
|
NamespaceID: request.GetNamespaceId(),
|
|
BusinessID: request.GetExecution().GetWorkflowId(),
|
|
RunID: request.GetExecution().GetRunId(),
|
|
}
|
|
ref := chasm.NewComponentRefByArchetypeID(key, request.GetArchetypeId())
|
|
if err := chasmEngine.DeleteExecution(ctx, ref, chasm.DeleteExecutionRequest{
|
|
TerminateComponentRequest: chasm.TerminateComponentRequest{
|
|
Reason: request.GetReason(),
|
|
Identity: request.GetIdentity(),
|
|
},
|
|
}); err != nil {
|
|
return nil, err
|
|
}
|
|
return &historyservice.DeleteExecutionResponse{}, nil
|
|
}
|