Skip to content
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

Ignore history events with worker_may_ignore: true. #2000

Merged
merged 4 commits into from
Mar 4, 2024

Conversation

chronos-tachyon
Copy link
Contributor

@chronos-tachyon chronos-tachyon commented Feb 29, 2024

What was changed

  • Unknown event types with worker_may_ignore: true are skipped
  • All other unknown event types continue to throw
  • Added new replay tests verifying that worker_may_ignore is handled correctly

Why?

The new worker_may_ignore flag is intended to mark events that can be handled as no-ops if the SDK doesn't know the event type.

Checklist

  1. Closes Fail task on unknown event when HistoryEvent.worker_may_ignore is false #1945

  2. How was this tested: added new unit tests to verify the new behavior before implementing it.

@chronos-tachyon chronos-tachyon requested a review from a team as a code owner February 29, 2024 22:54
Copy link
Member

@cretz cretz left a comment

Choose a reason for hiding this comment

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

LGTM, though may want @Quinn-With-Two-Ns to peek before merging.

@@ -430,7 +428,11 @@ private void handleSingleEvent(HistoryEvent event, boolean hasNextEvent) {
replaying = false;
}

Long initialCommandEventId = getInitialCommandEventId(event);
final long initialCommandEventId = getInitialCommandEventId(event);
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we document getInitialCommandEventId and the fact that if it returns < 0 the event can be ignored?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a docstring, but also switched from long / -1 to OptionalLong / empty() because it's less cognitive load.

@chronos-tachyon chronos-tachyon merged commit b182d78 into master Mar 4, 2024
8 checks passed
@chronos-tachyon chronos-tachyon deleted the dking/SDK-1392 branch March 4, 2024 21:54
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.

Fail task on unknown event when HistoryEvent.worker_may_ignore is false
3 participants