Skip to content

Commit b43588c

Browse files
authored
Fix update docstring to include context (#1785)
1 parent 3befe6b commit b43588c

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

workflow/workflow.go

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -545,19 +545,17 @@ func SetUpdateHandler(ctx Context, updateName string, handler interface{}) error
545545
return SetUpdateHandlerWithOptions(ctx, updateName, handler, UpdateHandlerOptions{})
546546
}
547547

548-
// SetUpdateHandlerWithOptions binds an update handler function to the specified
549-
// name such that update invocations specifying that name will invoke the
550-
// handler. The handler function can take as input any number of parameters so
551-
// long as they can be serialized/deserialized by the system. The handler can
552-
// take a [workflow.Context] as its first parameter but this is not required. The
553-
// update handler must return either a single error or a single serializable
554-
// object along with a single error. The update handler function is invoked in
555-
// the context of the workflow and thus is subject to the same restrictions as
556-
// workflow code, namely, the update handler must be deterministic. As with
557-
// other workflow code, update code is free to invoke and wait on the results of
558-
// activities. Update handler code is free to mutate workflow state.
559-
//
560-
// This registration can optionally specify (through UpdateHandlerOptions) an
548+
// SetUpdateHandlerWithOptions binds an update handler function to the specified name such that
549+
// update invocations specifying that name will invoke the handler. The handler function can take as
550+
// input any number of parameters so long as they can be serialized/deserialized by the system. The
551+
// handler must take a [workflow.Context] as its first parameter. The update handler must return
552+
// either a single error or a single serializable object along with a single error. The update
553+
// handler function is invoked in the context of the workflow and thus is subject to the same
554+
// restrictions as workflow code, namely, the update handler must be deterministic. As with other
555+
// workflow code, update code is free to invoke and wait on the results of activities. Update
556+
// handler code is free to mutate workflow state.
557+
//
558+
561559
// update validation function. If provided, this function will be invoked before
562560
// the update handler itself is invoked and if this function returns an error,
563561
// the update request will be considered to have been rejected and as such will
@@ -575,7 +573,7 @@ func SetUpdateHandler(ctx Context, updateName string, handler interface{}) error
575573
// err := workflow.SetUpdateHandlerWithOptions(
576574
// ctx,
577575
// "add",
578-
// func(val int) (int, error) { // Calls
576+
// func(ctx workflow.Context, val int) (int, error) { // Calls
579577
// counter += val // note that this mutates workflow state
580578
// return counter, nil
581579
// },

0 commit comments

Comments
 (0)