Add Actor Reminder/Timer TTL support - #912
Conversation
92ae1a8 to
d800f37
Compare
Codecov Report
@@ Coverage Diff @@
## master #912 +/- ##
==========================================
- Coverage 70.11% 69.79% -0.32%
==========================================
Files 152 154 +2
Lines 4939 5079 +140
Branches 543 549 +6
==========================================
+ Hits 3463 3545 +82
- Misses 1349 1402 +53
- Partials 127 132 +5
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. |
0c6a8ca to
5e4198e
Compare
This commit adds the TTL field to Actor reminders/timers. This allows reminders and timers to expire after a given TimeSpan instead of having to be manually deleted. dapr#788 Signed-off-by: Hal Spang <halspang@microsoft.com>
| await proxy.RegisterTimer(); | ||
| await proxy.RegisterReminder(); | ||
| await proxy.RegisterTimer(null); | ||
| await proxy.RegisterReminder(null); |
There was a problem hiding this comment.
nit: if this is a default-valued parameter you don't have to pass null here.
There was a problem hiding this comment.
The ActorProxy complained about the interface having a default value and without that, the top level doesn't appear to accept the default parameter. I'll look again as maybe I was just being wrong, but that's the behavior I observed.
| TimeSpan dueTime, | ||
| TimeSpan period) | ||
| TimeSpan period, | ||
| TimeSpan? ttl = null) |
There was a problem hiding this comment.
This is a breaking change. See: https://github.com/ltrzesniewski/dotnet-runtime/blob/master/docs/coding-guidelines/breaking-change-rules.md#signatures
This needs to be a new overload.
There was a problem hiding this comment.
When you add the new overload, we probably can't make ttl optional, because that will cause an ambiguity in overload resolution.
There was a problem hiding this comment.
Dang, I thought the default saved me from the breaking change. Thanks for letting me know! I'll fix this and apply throughout.
There was a problem hiding this comment.
When you add the new overload, we probably can't make ttl optional, because that will cause an ambiguity in overload resolution.
So this was a problem because null is semantically important here unfortunately. I didn't want to put in something like looking for a specific TimeSpan value made us remove the TTL because who knows what people want to put in (and if it's wrong I'd rather error). So I introduced a class that allows us to pass in a null while keeping a consistent API surface. Let me know what you think, it's generally internal because it felt weird to expose it.
| TimeSpan dueTime, | ||
| TimeSpan period) | ||
| TimeSpan period, | ||
| TimeSpan? ttl = null) |
There was a problem hiding this comment.
Same deal, this is a breaking change.
| TimeSpan dueTime, | ||
| TimeSpan period) | ||
| TimeSpan period, | ||
| TimeSpan? ttl = null) |
There was a problem hiding this comment.
This is also a breaking change.
There was a problem hiding this comment.
These are the best references I know of if you want to learn more:
- https://github.com/ltrzesniewski/dotnet-runtime/blob/master/docs/coding-guidelines/breaking-changes.md
- https://github.com/ltrzesniewski/dotnet-runtime/blob/master/docs/coding-guidelines/breaking-change-rules.md
- https://github.com/ltrzesniewski/dotnet-runtime/blob/master/docs/coding-guidelines/breaking-change-definitions.md
There was a problem hiding this comment.
I accidentally linked to someone's fork, but those should all be valid.
| TimeSpan dueTime, | ||
| TimeSpan period) | ||
| TimeSpan period, | ||
| TimeSpan? ttl = null) |
| this.Data = data; | ||
| this.DueTime = dueTime; | ||
| this.Period = period; | ||
| this.Ttl = ttl; |
There was a problem hiding this comment.
This is not a breaking change 😁 - internal type
| TimeSpan dueTime, | ||
| TimeSpan period) | ||
| TimeSpan period, | ||
| TimeSpan? ttl = null) |
There was a problem hiding this comment.
This is not a breaking change 👍 - internal type
Signed-off-by: Hal Spang <halspang@microsoft.com>
Description
This commit adds the TTL field to Actor reminders/timers. This allows
reminders and timers to expire after a given TimeSpan instead of
having to be manually deleted.
#788
Signed-off-by: Hal Spang halspang@microsoft.com
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: #788
Checklist
Please make sure you've completed the relevant tasks for this PR, out of the following list: