Skip to content

Commit ad5fe3c

Browse files
committed
comments
1 parent 9e7be97 commit ad5fe3c

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

dbos/serialization.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ func isJSONSerializer(s Serializer) bool {
7777
// This is needed because JSON deserialization loses type information when decoding
7878
// into `any` - it converts structs to map[string]interface{}, numbers to float64, etc.
7979
// By re-marshaling and unmarshaling into a typed target, we (mostly) restore the original structure.
80-
// We should be able to get ride of this when we lift encoding/decoding outside of the system database.
80+
// We should be able to get rid of this when we lift encoding/decoding outside of the system database.
8181
func convertJSONToType[T any](value any) (T, error) {
8282
if value == nil {
8383
return *new(T), nil

dbos/workflow.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,9 @@ func RegisterWorkflow[P any, R any](ctx DBOSContext, fn Workflow[P, R], opts ...
521521
if err != nil {
522522
return *new(R), newWorkflowExecutionError("", fmt.Errorf("getting workflow ID: %w", err))
523523
}
524+
// In async execution (e.g., recoverPendingWorkflows and queue runner), we don't know the input type
525+
// Here we can capture it and add the casting to the logic
526+
// Note that the input might come from the database.
524527
var typedInput P
525528
if isJSONSerializer(ctx.(*dbosContext).serializer) {
526529
var err error

0 commit comments

Comments
 (0)