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

Return collection instead of enumerable and fix/re-enable task scheduler check (💥 BREAKING CHANGES) #87

Merged
merged 4 commits into from
Jun 13, 2023

Conversation

cretz
Copy link
Member

@cretz cretz commented Jun 13, 2023

What was changed

  • Change converter/codec/etc non-streaming IEnumerable return values to IReadOnlyCollection
    • Lazy enumerables for this case were confusing users and are against best practices
    • 💥 BREAKING CHANGE on some return types
  • Fix issue that inadvertently disabled the task-on-workflow-scheduler checker (i.e. re-enable it)
    • 💥 BREAKING CHANGE on behavior because for the last couple of alphas this checker was inadvertently disabled
  • Provided workaround for Task.WhenAny sometimes using thread pool
    • Updated README and made Workflow.WhenAnyAsync that is workflow safe

@cretz cretz requested a review from a team June 13, 2023 16:23
@@ -689,10 +689,15 @@ with .NET tasks inside of workflows:
* Do not use `Task.Delay`, `Task.Wait`, timeout-based `CancellationTokenSource`, or anything that uses .NET built-in
timers.
* `Workflow.DelayAsync`, `Workflow.WaitConditionAsync`, or non-timeout-based cancellation token source is suggested.
* Do not use `Task.WhenAny`.
* Use `Workflow.WhenAnyAsync` instead.
Copy link
Member

Choose a reason for hiding this comment

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

Does this method require the Async suffix? Wouldn't it be better to match the Task API naming?

Copy link
Member Author

Choose a reason for hiding this comment

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

I chose Workflow.DelayAsync even though Task.Delay, so I did the same here. I think following VSTHRD200 everywhere is better than trying to match Task name exactly for the couple of alternatives we're providing.

Copy link
Member

Choose a reason for hiding this comment

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

I'd make exceptions here just because we're providing alternatives for known APIs.

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think we should (and didn't when we introduced DelayAsync). In fact, I suspect .NET regrets not suffixing these with Async back when they wrote it.

@cretz cretz merged commit 12ae2b3 into temporalio:main Jun 13, 2023
6 checks passed
@cretz cretz deleted the enumerable-return branch June 13, 2023 22:08
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.

2 participants