Skip to content

Conversation

amulyavarote
Copy link
Contributor

@amulyavarote amulyavarote commented Mar 14, 2022

Signed-off-by: Amulya Varote amulyavarote@microsoft.com

Description

Added TTL param to actor timer and reminder.

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: #141

Checklist

Please make sure you've completed the relevant tasks for this PR, out of the following list:

  • Code compiles correctly
  • Created/updated tests
  • Extended the documentation

@amulyavarote amulyavarote requested review from a team as code owners March 14, 2022 19:40
@codecov
Copy link

codecov bot commented Mar 14, 2022

Codecov Report

Merging #212 (3f08897) into master (7d9298a) will increase coverage by 0.15%.
The diff coverage is 67.74%.

@@            Coverage Diff             @@
##           master     #212      +/-   ##
==========================================
+ Coverage   30.56%   30.71%   +0.15%     
==========================================
  Files          70       72       +2     
  Lines        5644     5671      +27     
  Branches      172      177       +5     
==========================================
+ Hits         1725     1742      +17     
- Misses       3885     3892       +7     
- Partials       34       37       +3     
Impacted Files Coverage Δ
src/actors/client/ActorClient/ActorClientGRPC.ts 3.41% <0.00%> (-0.13%) ⬇️
src/actors/client/ActorClient/ActorClientHTTP.ts 40.00% <0.00%> (-4.45%) ⬇️
src/actors/runtime/AbstractActor.ts 74.28% <ø> (ø)
src/actors/runtime/ActorReminderData.ts 50.00% <50.00%> (-2.95%) ⬇️
test/actor/DemoActorReminderTtlImpl.ts 88.88% <88.88%> (ø)
test/actor/DemoActorTimerTtlImpl.ts 88.88% <88.88%> (ø)
test/actor/DemoActorReminder2Impl.ts 87.50% <100.00%> (ø)
test/actor/DemoActorReminderImpl.ts 88.88% <100.00%> (ø)
test/actor/DemoActorTimerImpl.ts 88.88% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7d9298a...3f08897. Read the comment docs.

@XavierGeerinck
Copy link
Contributor

Is there a file missing? I see a commit with a test file but I can't find it in the review?

dueTime: Temporal.Duration.from({ seconds: 2 }),
period: Temporal.Duration.from({ seconds: 1 })
period: Temporal.Duration.from({ seconds: 1 }),
ttl?: Temporal.Duration.from({ seconds: 1 }),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ttl?: Temporal.Duration.from({ seconds: 1 }),
ttl: Temporal.Duration.from({ seconds: 1 }),

await client.actor.reminderCreate(DemoActorImpl.name, `actor-id`, `timer-id`, {
dueTime: Temporal.Duration.from({ seconds: 2 }),
period: Temporal.Duration.from({ seconds: 1 }),
ttl?: Temporal.Duration.from({ seconds: 1 }),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ttl?: Temporal.Duration.from({ seconds: 1 }),
ttl: Temporal.Duration.from({ seconds: 1 }),

* @param reminderName name of the reminder
* @param state the state to be send along with the reminder trigger
* @param dueTime due time for the first trigger
* @param ttl time to live
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @param ttl time to live
* @param ttl time duration after which the reminder will be expired and deleted

}

async registerActorTimer(timerName: string, callback: string, dueTime: Temporal.Duration, period: Temporal.Duration, state?: any) {
async registerActorTimer(timerName: string, callback: string, dueTime: Temporal.Duration, ttl: Temporal.Duration, period: Temporal.Duration, state?: any) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add a documentation comment for this function too?

* @return Async void response
*/
async registerActorReminder<_Type>(reminderName: string, dueTime: Temporal.Duration, period: Temporal.Duration, state?: any) {
async registerActorReminder<_Type>(reminderName: string, dueTime: Temporal.Duration, ttl: Temporal.Duration, period: Temporal.Duration, state?: any) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ttl should be optional, right?

}

async registerActorTimer(timerName: string, callback: string, dueTime: Temporal.Duration, period: Temporal.Duration, state?: any) {
async registerActorTimer(timerName: string, callback: string, dueTime: Temporal.Duration, ttl: Temporal.Duration, period: Temporal.Duration, state?: any) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above for ttl being optional.

* @param period the time interval between reminder invocations after the first invocation
*/
constructor(reminderName: string, dueTime: number, period: number, state?: string | object) {
constructor(reminderName: string, dueTime: number, ttl: number, period: number, state?: string | object) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comments as above for ttl's param documentation and optional nature.


async init(): Promise<string> {
await super.registerActorReminder("my-reminder-name", Temporal.Duration.from({ seconds: 2 }), Temporal.Duration.from({ seconds: 1 }), 123);
await super.registerActorReminder("my-reminder-name", Temporal.Duration.from({ seconds: 2 }), Temporal.Duration.from({ seconds: 2 }), Temporal.Duration.from({ seconds: 1 }), 123);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: line break in params for readability


async init(): Promise<string> {
await super.registerActorReminder("my-reminder-name", Temporal.Duration.from({ seconds: 2 }), Temporal.Duration.from({ seconds: 1 }), 123);
await super.registerActorReminder("my-reminder-name", Temporal.Duration.from({ seconds: 2 }), Temporal.Duration.from({ seconds: 2 }), Temporal.Duration.from({ seconds: 1 }), 123);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: line break in params for readability


async init(): Promise<string> {
await super.registerActorTimer("my-timer-name", "countBy", Temporal.Duration.from({ seconds: 2 }), Temporal.Duration.from({ seconds: 1 }), 100);
await super.registerActorTimer("my-timer-name", "countBy", Temporal.Duration.from({ seconds: 2 }), Temporal.Duration.from({ seconds: 2 }), Temporal.Duration.from({ seconds: 1 }), 100);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: line break in params for readability

Copy link
Member

@shubham1172 shubham1172 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM @amulyavarote, only had a few nits.

@amulyavarote amulyavarote force-pushed the feature/actors_reminder_ttl branch 2 times, most recently from ea7f558 to 2373715 Compare April 14, 2022 00:18
amulyavarote and others added 9 commits April 19, 2022 10:36
Signed-off-by: Amulya Varote <amulyavarote@QTM-SWATHIKIL-1.redmond.corp.microsoft.com>
Signed-off-by: Amulya Varote <amulyavarote@microsoft.com>
Signed-off-by: Amulya Varote <amulyavarote@QTM-SWATHIKIL-1.redmond.corp.microsoft.com>
Signed-off-by: Amulya Varote <amulyavarote@microsoft.com>
Signed-off-by: Amulya Varote <amulyavarote@QTM-SWATHIKIL-1.redmond.corp.microsoft.com>
Signed-off-by: Amulya Varote <amulyavarote@microsoft.com>
Signed-off-by: Amulya Varote <amulyavarote@QTM-SWATHIKIL-1.redmond.corp.microsoft.com>
Signed-off-by: Amulya Varote <amulyavarote@microsoft.com>
Signed-off-by: Amulya Varote <amulyavarote@QTM-SWATHIKIL-1.redmond.corp.microsoft.com>
Signed-off-by: Amulya Varote <amulyavarote@microsoft.com>
Signed-off-by: Amulya Varote <amulyavarote@QTM-SWATHIKIL-1.redmond.corp.microsoft.com>
Signed-off-by: Amulya Varote <amulyavarote@microsoft.com>
Signed-off-by: Amulya Varote <amulyavarote@microsoft.com>
Signed-off-by: Amulya Varote <amulyavarote@microsoft.com>
Signed-off-by: Amulya Varote <amulyavarote@microsoft.com>
@amulyavarote amulyavarote force-pushed the feature/actors_reminder_ttl branch from 2373715 to 3f08897 Compare April 19, 2022 17:43
@XavierGeerinck XavierGeerinck merged commit eb6ee2e into dapr:master Apr 19, 2022
@amulyavarote amulyavarote deleted the feature/actors_reminder_ttl branch April 19, 2022 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: Actors Reminder/Timer TTL
3 participants