You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Added support to actor timers get/list methods - #1949
Scheduling with period: Timeout.InfiniteTimeSpan creates a one-shot timer, but Get/List expose its period as -1 ms here. The sidecar scheduler omits negative periods and returns null instead, so consumers see different metadata for the same registration in memory and in production. Normalize negative periods to null in the stored timer info.
Support Go microsecond suffix in timer duration parsing
The runtime returns a 250-microsecond timer period as @every 250µs, but ActorScheduleDurationParser recognizes only ASCII us. As a result, GetAsync throws for that timer, and one such timer makes the entire ListAsync call throw. Accept Go's µs suffix in both the parser's regular expression and unit conversion, and cover it in get/list response tests.
Normalize virtual scheduler infinite periods to null
The virtual scheduler also exposes Timeout.InfiniteTimeSpan as a -1 ms Period for one-shot timers. The sidecar returns null for this registration, so tests using virtual time observe different Get/List metadata from production. Normalize negative original periods to null when creating timer info, without changing reminder metadata.
Dapr accepts an absolute RFC 3339 dueTime and preserves that input in get/list responses. A timer registered with a timestamp, for example through HTTP, therefore reaches this duration-only parser and throws FormatException. The same mapping at line 299 makes one such timer prevent listing all timers for the actor. Define how absolute due times are represented in ActorTimerInfo, handle them in both mappings, and add get/list tests for timestamp-based registrations.
Handle Go microsecond units in timer duration parsing
A timer scheduled with a 0.5 ms period is returned by Dapr as @every 500µs. ActorScheduleDurationParser accepts ASCII us, but not Go's µs, so GetAsync throws FormatException; one such timer also makes the entire ListAsync call fail. Normalize the unit in both mappings, or support it in the shared parser, and add get/list regression coverage.
HTTP timers can use Go due times such as +1h, .5s, 1.s, and 1h.5m, which the runtime echoes unchanged. Parse cannot fully consume these forms and falls back to TimeSpan.Parse, which rejects their unit suffixes. As a result, GetAsync throws and one such registration makes ListAsync fail for the entire actor. Support the leading sign and leading/trailing decimal-point forms in the shared parser, with regression tests for these inputs.
Normalize nonpositive timer periods to null metadata
Passing TimeSpan.Zero or Timeout.InfiniteTimeSpan as the period creates a one-shot timer, but this stores a non-null Period in its get/list metadata. That contradicts ActorTimerInfo.Period's null-for-one-shot contract and misclassifies the timer for callers using Period.HasValue. Normalize nonpositive periods to null when constructing the metadata, and cover both values in the core scheduler tests.
An explicitly registered zero period is returned by the sidecar as @every 0s for a one-shot timer. This mapping exposes TimeSpan.Zero instead of the null promised by ActorTimerInfo.Period, so callers using Period.HasValue misclassify it as periodic. Normalize nonpositive parsed periods to null and add a sidecar mapping test for @every 0s.
Normalize virtual scheduler one-shot periods to null
The virtual scheduler treats zero and Timeout.InfiniteTimeSpan periods as one-shot, but this mapping returns those values as a non-null Period. This violates ActorTimerInfo.Period's null-for-one-shot contract and misclassifies timers for callers using Period.HasValue in ActorTestRuntime. Normalize nonpositive periods to null here and cover both inputs in the virtual scheduler tests.
One-shot timers become unqueryable before their callbacks finish. Here, onCompleted removes the registration before runtime.DispatchAsync; the direct VirtualActorTimeProvider scheduler similarly sets Canceled = true before dispatch, so its new get/list methods exclude the timer. In the runtime implementation linked by this PR, removal happens after CallReminder returns. Consequently, a callback inspecting its own timer can find it through the sidecar but not through either in-memory scheduler. Keep an admitted one-shot queryable until dispatch finishes, including failure, without admitting it twice. Preserve cancellation and replacement identity checks, and add callback-level get/list tests for both implementations.
@m3nax If you can confirm this is safe to take out of draft, I'd be happy to merge it into the 1.19 release (but note that you have about 6 hours until it'll have to wait for an SDK patch release).
@WhitWaldo Some checks seem to be failing, but I don’t think they’re related to my changes. Could you re-run them manually? If they pass, I think everything’s ready.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Add support for actor list/get timers runtime methods dapr/dapr#10461
Issue reference
We strive to have all PR being opened based on an issue, where the problem or feature have been discussed prior to implementation.
Please reference the issue this PR will close: #1948
Checklist
Please make sure you've completed the relevant tasks for this PR, out of the following list: