mirror of
https://github.com/temporalio/temporal.git
synced 2026-08-31 02:51:51 -07:00
## What changed? Makes Standalone Activity conflict updates idempotent by recording the `requestID` when attaching callbacks or links and recognizing duplicate request IDs. I needed to add a dedicated CHASM error for ## Why? This prevents a successful attachment whose response was lost from failing on retry or duplicating/replacing callbacks and links. ## How did you test it? - [ ] built - [ ] run locally and tested manually - [ ] covered by existing tests - [x] added new unit test(s) - [x] added new functional test(s)
28 lines
792 B
Go
28 lines
792 B
Go
package chasm
|
|
|
|
import "go.temporal.io/api/serviceerror"
|
|
|
|
// ErrRequestIDAlreadyUsed is returned by UpdateComponent when the request ID supplied via
|
|
// WithRequestID has already been recorded on the execution.
|
|
var ErrRequestIDAlreadyUsed = serviceerror.NewFailedPrecondition("request ID has already been used for this execution")
|
|
|
|
type ExecutionAlreadyStartedError struct {
|
|
Message string
|
|
CurrentRequestID string
|
|
CurrentRunID string
|
|
}
|
|
|
|
func NewExecutionAlreadyStartedErr(
|
|
message, currentRequestID, currentRunID string,
|
|
) *ExecutionAlreadyStartedError {
|
|
return &ExecutionAlreadyStartedError{
|
|
Message: message,
|
|
CurrentRequestID: currentRequestID,
|
|
CurrentRunID: currentRunID,
|
|
}
|
|
}
|
|
|
|
func (e *ExecutionAlreadyStartedError) Error() string {
|
|
return e.Message
|
|
}
|