feat: implement V2 alert center and scoped alert governance
This commit is contained in:
@@ -95,6 +95,19 @@ func TestRunMethodCancellationStopsRetryDelay(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestRunMethodCancellationWinsConcurrentAttemptFailure(t *testing.T) {
|
||||
for i := 0; i < 32; i++ {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
registry := platformtask.NewRegistry()
|
||||
registry.Register(platformtask.Method{Name: "cancel-at-return", Run: func(context.Context, json.RawMessage) error { cancel(); return errors.New("temporary") }})
|
||||
err := (&TaskExecutor{methods: registry}).runMethod(ctx, &taskbiz.TimedTask{MethodName: "cancel-at-return", Params: []byte(`{"_execution":{"maxRetryTimes":3,"retryIntervalSeconds":60}}`)})
|
||||
cancel()
|
||||
if !errors.Is(err, context.Canceled) {
|
||||
t.Fatalf("并发取消被执行错误覆盖: %v", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestRunMethodUsesParentContext(t *testing.T) {
|
||||
const methodName = "worker-test-parent-context"
|
||||
started := make(chan struct{})
|
||||
|
||||
Reference in New Issue
Block a user