Files
Roey BermanandGitHub 6263044d8c Implement operation cancelation executors (#5801)
## What changed?

- Implemented operation cancelation executors
- Fixed bug where we weren't correctly identifying service not found
errors
- Fixed bug where task would fail instead of operation when service is
not found
- Fixed bug where context timeout was on the task instead of the request
for callback and operation invocations preventing saving the result
- Moved `GenerateEventLoadToken` from being a mutable state method to a
static method as it does not require access to mutable state and makes
this method accessible in more contexts
- Added `LoadHistoryEvent` to the `MutableState` interface so it is
generated in the mock.

## Why?

Part of the functionality for nexus operations.
Note that in the future we'll want to support canceling a not yet
started operation. There are TODOs in the code base to address this. For
now if an operation is canceled before start is recorded, cancelation
isn't transmitted to the handler even though the operation may be
already started.

## How did you test it?

Added and rewrote tests.
2024-04-30 16:54:22 -07:00

44 lines
1.7 KiB
Go

// The MIT License
//
// Copyright (c) 2024 Temporal Technologies Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
package callbacks
import (
"time"
"go.temporal.io/server/common/dynamicconfig"
)
// RequestTimeout is the timeout for executing a single callback request.
const RequestTimeout = dynamicconfig.Key("component.callbacks.request.timeout")
type Config struct {
RequestTimeout dynamicconfig.DurationPropertyFn
}
func ConfigProvider(dc *dynamicconfig.Collection) *Config {
return &Config{
// TODO(bergundy): This should be controllable per namespace + destination.
RequestTimeout: dc.GetDurationProperty(RequestTimeout, time.Second*10),
}
}