mirror of
https://github.com/hanzoai/tasks.git
synced 2026-10-30 14:56:19 +00:00
## What changed? Added a SideEffectDiscardHandler interface to the CHASM framework that allows side-effect task executors to define custom discard behavior on standby clusters. When a side-effect task has been pending on standby past the configurable discard delay (ChasmStandbyTaskDiscardDelay), the framework now calls HandleDiscard instead of silently discarding the task. Implemented the handler for ActivityDispatchTask to spill tasks to matching on standby clusters. ## Why? On standby clusters, CHASM side-effect tasks (e.g., ActivityDispatchTask) were silently discarded after the discard delay. For standalone activities, this means the activity task never gets pushed to the standby cluster's matching queue, so workers on the standby cluster can't pick up work even after a failover. The HandleDiscard hook lets task executors define spillover behavior — the activity dispatch executor uses it to push to matching on standby, enabling faster recovery after namespace failover. ## How did you test it? - [X] built - [ ] run locally and tested manually - [ ] covered by existing tests - [X] added new unit test(s) - [X] added new functional test(s)
39 lines
1.8 KiB
Go
39 lines
1.8 KiB
Go
package chasm
|
|
|
|
const (
|
|
testLibraryName = "TestLibrary"
|
|
testComponentName = "test_component"
|
|
testSubComponent1Name = "test_sub_component_1"
|
|
testSubComponent11Name = "test_sub_component_11"
|
|
testSubComponent2Name = "test_sub_component_2"
|
|
|
|
testSideEffectTaskName = "test_side_effect_task"
|
|
testDiscardableSideEffectTaskName = "test_discardable_side_effect_task"
|
|
testOutboundSideEffectTaskName = "test_outbound_side_effect_task"
|
|
testPureTaskName = "test_pure_task"
|
|
)
|
|
|
|
var (
|
|
testComponentFQN = FullyQualifiedName(testLibraryName, testComponentName)
|
|
testSubComponent1FQN = FullyQualifiedName(testLibraryName, testSubComponent1Name)
|
|
testSubComponent11FQN = FullyQualifiedName(testLibraryName, testSubComponent11Name)
|
|
testSubComponent2FQN = FullyQualifiedName(testLibraryName, testSubComponent2Name)
|
|
|
|
testSideEffectTaskFQN = FullyQualifiedName(testLibraryName, testSideEffectTaskName)
|
|
testDiscardableSideEffectTaskFQN = FullyQualifiedName(testLibraryName, testDiscardableSideEffectTaskName)
|
|
testOutboundSideEffectTaskFQN = FullyQualifiedName(testLibraryName, testOutboundSideEffectTaskName)
|
|
testPureTaskFQN = FullyQualifiedName(testLibraryName, testPureTaskName)
|
|
)
|
|
|
|
var (
|
|
testComponentTypeID = GenerateTypeID(testComponentFQN)
|
|
testSubComponent1TypeID = GenerateTypeID(testSubComponent1FQN)
|
|
testSubComponent11TypeID = GenerateTypeID(testSubComponent11FQN)
|
|
testSubComponent2TypeID = GenerateTypeID(testSubComponent2FQN)
|
|
|
|
testSideEffectTaskTypeID = GenerateTypeID(testSideEffectTaskFQN)
|
|
testDiscardableSideEffectTaskTypeID = GenerateTypeID(testDiscardableSideEffectTaskFQN)
|
|
testOutboundSideEffectTaskTypeID = GenerateTypeID(testOutboundSideEffectTaskFQN)
|
|
testPureTaskTypeID = GenerateTypeID(testPureTaskFQN)
|
|
)
|