-
Notifications
You must be signed in to change notification settings - Fork 94
Added TTL param to actor timer and reminder #212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added TTL param to actor timer and reminder #212
Conversation
Codecov Report
@@ 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
Continue to review full report at Codecov.
|
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 }), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 }), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ttl?: Temporal.Duration.from({ seconds: 1 }), | |
ttl: Temporal.Duration.from({ seconds: 1 }), |
src/actors/runtime/AbstractActor.ts
Outdated
* @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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @param ttl time to live | |
* @param ttl time duration after which the reminder will be expired and deleted |
src/actors/runtime/AbstractActor.ts
Outdated
} | ||
|
||
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) { |
There was a problem hiding this comment.
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?
src/actors/runtime/AbstractActor.ts
Outdated
* @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) { |
There was a problem hiding this comment.
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?
src/actors/runtime/AbstractActor.ts
Outdated
} | ||
|
||
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) { |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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.
test/actor/DemoActorReminder2Impl.ts
Outdated
|
||
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); |
There was a problem hiding this comment.
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
test/actor/DemoActorReminderImpl.ts
Outdated
|
||
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); |
There was a problem hiding this comment.
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
test/actor/DemoActorTimerImpl.ts
Outdated
|
||
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); |
There was a problem hiding this comment.
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
There was a problem hiding this 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.
ea7f558
to
2373715
Compare
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>
2373715
to
3f08897
Compare
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: