-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix: add timestamp to trigger immediately signal #7968
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
Conversation
…r-immediately-bug
_**READ BEFORE MERGING:** All PRs require approval by both Server AND SDK teams before merging! This is why the number of required approvals is "2" and not "1"--two reviewers from the same team is NOT sufficient. If your PR is not approved by someone in BOTH teams, it may be summarily reverted._ <!-- Describe what has changed in this PR --> **What changed?** adding a timestamp to `TriggerImmediatelyRequest` message <!-- Tell your future self why have you made these changes --> We can make the wft “more idempotent”: put the desired trigger time in the trigger immediately request itself, so it goes in the signal payload, so all wfts attempt to start the target with the same id. <!-- Are there any breaking changes on binary or code level? --> **Breaking changes** <!-- If this breaks the Server, please provide the Server PR to merge right after this PR was merged. --> [**Server PR**](temporalio/temporal#7968)
_**READ BEFORE MERGING:** All PRs require approval by both Server AND SDK teams before merging! This is why the number of required approvals is "2" and not "1"--two reviewers from the same team is NOT sufficient. If your PR is not approved by someone in BOTH teams, it may be summarily reverted._ <!-- Describe what has changed in this PR --> **What changed?** adding a timestamp to `TriggerImmediatelyRequest` message <!-- Tell your future self why have you made these changes --> We can make the wft “more idempotent”: put the desired trigger time in the trigger immediately request itself, so it goes in the signal payload, so all wfts attempt to start the target with the same id. <!-- Are there any breaking changes on binary or code level? --> **Breaking changes** <!-- If this breaks the Server, please provide the Server PR to merge right after this PR was merged. --> [**Server PR**](temporalio/temporal#7968)
service/worker/scheduler/testdata/replay_with_trigger_immediately_timestamp.json.gz
Outdated
Show resolved
Hide resolved
{ | ||
at: time.Date(2022, 6, 1, 0, 30, 0, 0, time.UTC), | ||
f: func() { | ||
// this one runs with overridden overlap policy | ||
s.env.SignalWorkflow(SignalNamePatch, &schedulepb.SchedulePatch{ | ||
TriggerImmediately: &schedulepb.TriggerImmediatelyRequest{ | ||
ScheduledTime: timestamppb.New(time.Date(2022, 6, 1, 0, 30, 0, 0, time.UTC)), |
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 change the value to check that it's actually used?
I think then we'll need to bump the current version in this test?
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.
Changing the ScheduledTime to ScheduledTime: timestamppb.New(time.Date(2022, 6, 1, 0, 40, 0, 0, time.UTC)),
will cause the test to fail with:
Error Trace: /Users/seankane/git/github.com/temporalio/temporal/service/worker/scheduler/workflow_test.go:305
/Users/seankane/git/github.com/temporalio/temporal/service/worker/scheduler/workflow_test.go:1137
Error: Not equal:
expected: 2
actual : 1
Test: TestWorkflow/TestTriggerImmediate
Messages: started map[string]time.Time{"myid-2022-06-01T00:15:00Z":time.Date(2022, time.June, 1, 0, 15, 0, 0, time.UTC)}
I think that shows it's used as we expect. I don't see a way to indicate a test should fail though so I'm not sure what the change here should be
_**READ BEFORE MERGING:** All PRs require approval by both Server AND SDK teams before merging! This is why the number of required approvals is "2" and not "1"--two reviewers from the same team is NOT sufficient. If your PR is not approved by someone in BOTH teams, it may be summarily reverted._ <!-- Describe what has changed in this PR --> **What changed?** adding a timestamp to `TriggerImmediatelyRequest` message <!-- Tell your future self why have you made these changes --> We can make the wft “more idempotent”: put the desired trigger time in the trigger immediately request itself, so it goes in the signal payload, so all wfts attempt to start the target with the same id. <!-- Are there any breaking changes on binary or code level? --> **Breaking changes** <!-- If this breaks the Server, please provide the Server PR to merge right after this PR was merged. --> [**Server PR**](temporalio/temporal#7968)
_**READ BEFORE MERGING:** All PRs require approval by both Server AND SDK teams before merging! This is why the number of required approvals is "2" and not "1"--two reviewers from the same team is NOT sufficient. If your PR is not approved by someone in BOTH teams, it may be summarily reverted._ <!-- Describe what has changed in this PR --> **What changed?** adding a timestamp to `TriggerImmediatelyRequest` message <!-- Tell your future self why have you made these changes --> We can make the wft “more idempotent”: put the desired trigger time in the trigger immediately request itself, so it goes in the signal payload, so all wfts attempt to start the target with the same id. <!-- Are there any breaking changes on binary or code level? --> **Breaking changes** <!-- If this breaks the Server, please provide the Server PR to merge right after this PR was merged. --> [**Server PR**](temporalio/temporal#7968)
## What changed? add a timestamp to the `TriggerImmediately` schedule for use instead of now() ## Why? We can make the wft “more idempotent”: put the desired trigger time in the trigger immediately request itself, so it goes in the signal payload, so all wfts attempt to start the target with the same id. ## How did you test it? - [ ] built - [ ] run locally and tested manually - [ ] covered by existing tests - [x] added new unit test(s) - [ ] added new functional test(s) ## Potential risks TBD @dnr @lina-temporal
What changed?
add a timestamp to the
TriggerImmediately
schedule for use instead of now()Why?
We can make the wft “more idempotent”: put the desired trigger time in the trigger immediately request itself, so it goes in the signal payload, so all wfts attempt to start the target with the same id.
How did you test it?
Potential risks
TBD @dnr @lina-temporal