Skip to content

Commit b932fc6

Browse files
committed
release in awaitCapabilites instead of callCapAsync
1 parent 8f688ad commit b932fc6

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

pkg/workflows/wasm/host/execution.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ func (e *execution[T]) callCapAsync(ctx context.Context, req *sdkpb.CapabilityRe
5252
e.capabilityResponses[req.CallbackId] = ch
5353

5454
go func() {
55-
defer func() { <-e.pendingCallsSem }()
56-
5755
resp, err := e.executor.CallCapability(ctx, req)
5856

5957
if err != nil {
@@ -92,6 +90,7 @@ func (e *execution[T]) awaitCapabilities(ctx context.Context, acr *sdkpb.AwaitCa
9290
}
9391

9492
delete(e.capabilityResponses, callId)
93+
<-e.pendingCallsSem
9594
}
9695

9796
return &sdkpb.AwaitCapabilitiesResponse{
@@ -118,8 +117,6 @@ func (e *execution[T]) getSecretsAsync(ctx context.Context, req *sdkpb.GetSecret
118117
e.secretsResponses[req.CallbackId] = ch
119118

120119
go func() {
121-
defer func() { <-e.pendingCallsSem }()
122-
123120
resp, err := e.executor.GetSecrets(ctx, req)
124121
sr := &secretsResponse{responses: resp, err: err}
125122

@@ -155,6 +152,7 @@ func (e *execution[T]) awaitSecrets(ctx context.Context, acr *sdkpb.AwaitSecrets
155152
}
156153

157154
delete(e.secretsResponses, callId)
155+
<-e.pendingCallsSem
158156
}
159157

160158
return &sdkpb.AwaitSecretsResponse{

0 commit comments

Comments
 (0)