Skip to content

Commit 7476f21

Browse files
committed
Fix: Use nils for presence checking
Signed-off-by: Albert Callarisa <[email protected]>
1 parent 979834e commit 7476f21

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

backend/runtimestate/runtimestate.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"github.com/dapr/durabletask-go/api"
1313
"github.com/dapr/durabletask-go/api/helpers"
1414
"github.com/dapr/durabletask-go/api/protos"
15+
"github.com/dapr/kit/ptr"
1516
)
1617

1718
var ErrDuplicateEvent = errors.New("duplicate event")
@@ -143,20 +144,20 @@ func ApplyActions(s *protos.OrchestrationRuntimeState, customStatus *wrapperspb.
143144
// Create a router for the completion event that routes back to the parent
144145
var completionRouter *protos.TaskRouter
145146
if action.Router != nil {
146-
var parentAppID string
147+
var parentAppID *string
147148

148149
allEvents := append(s.OldEvents, s.NewEvents...)
149150
for _, event := range allEvents {
150151
if es := event.GetExecutionStarted(); es != nil && event.GetRouter() != nil {
151-
parentAppID = event.GetRouter().GetSource()
152+
parentAppID = ptr.Of(event.GetRouter().GetSource())
152153
break
153154
}
154155
}
155156

156-
if parentAppID != "" {
157+
if parentAppID != nil {
157158
completionRouter = &protos.TaskRouter{
158159
Source: action.Router.Source,
159-
Target: &parentAppID,
160+
Target: parentAppID,
160161
}
161162
} else {
162163
completionRouter = action.Router

task/orchestrator.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ func (ctx *OrchestrationContext) processEvent(e *backend.HistoryEvent) error {
216216
router := e.GetRouter()
217217
// For cross-app suborchestrations, if we have a target, use that as our appID
218218
// since that's where we're actually executing
219-
if router.GetTarget() != "" {
219+
if router.Target != nil {
220220
ctx.appID = ptr.Of(router.GetTarget())
221221
} else {
222222
ctx.appID = ptr.Of(router.GetSource())

0 commit comments

Comments
 (0)