Skip to content

[Cosmos DB] Handle cases where desired worker count exceeds int.MaxInt#873

Merged
ealsur merged 7 commits into
devfrom
user/vchiang/fixoverflow
Oct 31, 2023
Merged

[Cosmos DB] Handle cases where desired worker count exceeds int.MaxInt#873
ealsur merged 7 commits into
devfrom
user/vchiang/fixoverflow

Conversation


try
{
targetWorkerCount = (int)Math.Ceiling(remainingWork / (decimal)concurrency);
Copy link
Copy Markdown
Contributor

@paulbatum paulbatum Oct 24, 2023

Choose a reason for hiding this comment

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

I suggest wrapping in a checked block - doing so makes sure that this operation will always throw an overflow exception regardless of the project level settings

https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/statements/checked-and-unchecked

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

done, updated all other SDK PRs to match this implementation

@pragnagopa pragnagopa requested a review from alrod October 26, 2023 16:59
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.

4 participants