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

REST Class Modifications #61

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft

REST Class Modifications #61

wants to merge 7 commits into from

Conversation

mphilipp622
Copy link
Contributor

This PR contains several changes:

  • Async GET methods modified to use Task.Yield() to prevent problems of tight-loop awaits using Task.Delay(). This was tested in PolyRules and significantly improved download times.
  • New class RestRequestThrottler is used to track active web requests and throttle them in a thread-safe manner. This is used to help prevent port exhaustion from sending too many simultaneous requests. Current values were determined by doing some basic performance testing on around 100 concurrent requests.
  • Changes were made to disposals of web requests. Previously, disposals were not being handled entirely properly in several methods. THings such as cancellations or abrupt shutting down of the app would not properly dispose web request handlers, potentially causing issues later.

…k to delay longer so CPU doesn't get bogged down in context switching
The initial change is unneeded and should not be touched at this time just for safety.
This allows us to download files via a POST request, if needed. While this is not a common use case, we have an endpoint for module manifests that requires a body containing data to archive into a ZIP file. If Unity could send GET requests with a body, this wouldn't be an issue, but you can't.
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.

1 participant