dapr / dapr/dotnet-sdk

WaitForSidecarAsync should accept input as to which sidecar [optional?] services to wait for (with timeout)

Open
#1,351 1 comment 1 reaction 0 assignees View on GitHub
area/client kind/enhancement
Dominant language
C#
Stars
1.2k
Forks
378
Avg merge
2d 1h
Merged PRs (30d)
6

Description

## Describe the feature

Example: With DAPR workflows hosted in an app that also listens to a binding or pubsub (i.e. it declares an appPort), there is a race condition between the DAPR sidecar detecting the appPort as open, and the actor runtime initializing. DAPR blocks until it detects all declared appPorts, and only initializes the actor runtime **after** this has completed.

Meanwhile, any app that tries to start a workflow after calling daprClient.WaitForSideAsync() -- which returns before the actor runtime is ready -- the call to ScheduleNewWorkflowAsync fails with an "actor runtime is not configured" error.

Retrying the ScheduleNewWorkflowAsync call after a few seconds generally succeeds, but it seems that WaitForSidecarAsync should not return until all declared services are truly ready.

I suggest allowing which services to wait for, along with a timeout (default timeout 30 seconds, perhaps.) I understand that the actor runtime is not a foundational service as it needs a dedicated statestore configured, but this is why we need this method parameterized.

e.g.

public async Task WaitForSidecarAsync(WaitForSidecarOptions options, CancellationToken token);

public record WaitForSidecarOptions(... RequireActorRuntime = false);

## Release Note

RELEASE NOTE:

Contributor guide

Open the contributing guide

Research direction

Start by locating WaitForSidecarAsync and the ScheduleNewWorkflowAsync call path in the .NET SDK. Read how sidecar readiness and cancellation are currently handled, then verify the requested service selection and timeout behavior, including actor runtime readiness, with tests covering the default and optional requirements.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.