default drain_ongoing_call_timeout to None#1016
Conversation
ActorRuntimeConfig hardcoded drain_ongoing_call_timeout to 60s. The Dapr runtime's placement dissemination timeout defaults to 30s and drain blocks the placement LOCK -> UPDATE -> UNLOCK round, so a 60s drain stalls the disseminator and resets the placement stream. Match the other SDKs (.NET, Go, Java, JS) by leaving the field unset, so daprd applies its 2s default (api.DefaultOngoingCallTimeout). Omit the field from as_dict() when None so a JSON null is not sent to the runtime. Signed-off-by: joshvanl <me@joshvanl.dev>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1016 +/- ##
==========================================
- Coverage 86.63% 81.49% -5.14%
==========================================
Files 84 138 +54
Lines 4473 13482 +9009
==========================================
+ Hits 3875 10987 +7112
- Misses 598 2495 +1897 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR updates the Python SDK’s ActorRuntimeConfig defaults to avoid sending an explicit drainOngoingCallTimeout value to daprd, allowing the runtime to apply its own default instead of the SDK hardcoding 60s (which can interfere with placement dissemination timing).
Changes:
- Default
ActorRuntimeConfig.drain_ongoing_call_timeouttoNoneinstead of 60s. - Omit
drainOngoingCallTimeoutfromActorRuntimeConfig.as_dict()when the value isNone(avoid sending JSONnull). - Update and extend actor runtime config tests to reflect the new default and serialization behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
dapr/actor/runtime/config.py |
Changes default drain_ongoing_call_timeout to None and conditionally serializes drainOngoingCallTimeout only when set. |
tests/actor/test_actor.py |
Updates actor config default expectation to None. |
tests/actor/test_actor_runtime.py |
Updates actor runtime config default expectation to None. |
tests/actor/test_actor_runtime_config.py |
Updates default config tests and adds coverage asserting the key is omitted when unset and present when explicitly set. |
Comments suppressed due to low confidence (1)
dapr/actor/runtime/config.py:125
actor_type_configsuses a mutable default ([]) in theActorRuntimeConfig.__init__signature. This list instance will be shared acrossActorRuntimeConfig()calls, which can cause cross-instance state leakage if the list is ever mutated. Preferactor_type_configs: Optional[List[ActorTypeConfig]] = Noneand assignactor_type_configs or []inside the constructor.
drain_ongoing_call_timeout: Optional[timedelta] = None,
drain_rebalanced_actors: Optional[bool] = True,
reentrancy: Optional[ActorReentrancyConfig] = None,
reminders_storage_partitions: Optional[int] = None,
actor_type_configs: List[ActorTypeConfig] = [],
):
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: joshvanl <me@joshvanl.dev>
ActorRuntimeConfig hardcoded drain_ongoing_call_timeout to 60s. The Dapr runtime's placement dissemination timeout defaults to 30s and drain blocks the placement LOCK -> UPDATE -> UNLOCK round, so a 60s drain stalls the disseminator and resets the placement stream.
Match the other SDKs (.NET, Go, Java, JS) by leaving the field unset, so daprd applies its 2s default (api.DefaultOngoingCallTimeout). Omit the field from as_dict() when None so a JSON null is not sent to the runtime.