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

Handle Octokit.RateLimitExceededException (And Allow Server to Start) #184

Closed
ghost opened this issue Apr 27, 2016 · 2 comments
Closed

Handle Octokit.RateLimitExceededException (And Allow Server to Start) #184

ghost opened this issue Apr 27, 2016 · 2 comments

Comments

@ghost
Copy link

ghost commented Apr 27, 2016

Plex Requests.Net Version:

1.6.1

Operating System:

Windows 10 Pro Insider Preview

Mono Version:

.NET Framework 4.6.1

Applicable Logs (from /logs/ directory or the Admin page):

Exception message happens at startup:

Unhandled Exception: System.AggregateException: One or more errors occurred. ---> Octokit.RateLimitExceededException: API rate limit exceeded for [REDACTED]. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)
   at Octokit.Connection.HandleErrors(IResponse response) in C:\Users\shiftkey\Documents\GitHub\octokit.net\Octokit\Http\Connection.cs:line 570
   at Octokit.Connection.<RunRequest>d__52.MoveNext() in C:\Users\shiftkey\Documents\GitHub\octokit.net\Octokit\Http\Connection.cs:line 552
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Octokit.Connection.<Run>d__51`1.MoveNext() in C:\Users\shiftkey\Documents\GitHub\octokit.net\Octokit\Http\Connection.cs:line 537
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Octokit.ApiConnection.<GetPage>d__33`1.MoveNext() in C:\Users\shiftkey\Documents\GitHub\octokit.net\Octokit\Http\ApiConnection.cs:line 0
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Octokit.ApiConnection.<>c__DisplayClass13_0`1.<<GetAll>b__0>d.MoveNext() in C:\Users\shiftkey\Documents\GitHub\octokit.net\Octokit\Http\ApiConnection.cs:line 0
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Octokit.ApiPagination.<GetAllPages>d__0`1.MoveNext() in C:\Users\shiftkey\Documents\GitHub\octokit.net\Octokit\Clients\ApiPagination.cs:line 0
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at PlexRequests.Core.StatusChecker.<GetLatestRelease>d__6.MoveNext() in C:\projects\requestplex\PlexRequests.Core\StatusChecker.cs:line 50
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at System.Threading.Tasks.Task`1.get_Result()
   at PlexRequests.Core.StatusChecker.GetStatus() in C:\projects\requestplex\PlexRequests.Core\StatusChecker.cs:line 63
   at PlexRequests.Core.Setup.CheckSchema() in C:\projects\requestplex\PlexRequests.Core\Setup.cs:line 77
   at PlexRequests.Core.Setup.SetupDb(String urlBase) in C:\projects\requestplex\PlexRequests.Core\Setup.cs:line 55
   at PlexRequests.UI.Program.Main(String[] args) in C:\projects\requestplex\PlexRequests.UI\Program.cs:line 91

Server does not start after exception.

Reproduction Steps:

Presumably, start the server a bunch of times to the point of reaching the GitHub/Octokit rate limit.

@tidusjar
Copy link
Member

Correct, you have reached the Github api limit. I am not sure there is much we can do about this. We can continue the application but we run the risk of not knowing your version and not updating any backend stuff correctly e.g. DB.

After looking at the code I think we do not have to call github on startup to prevent this.

All we need is the assembly version I think. https://github.com/tidusjar/PlexRequests.Net/blob/dev/PlexRequests.Core/StatusChecker.cs#L59

@tidusjar
Copy link
Member

I have fixed this in the latest dev build.

We didn't really need to check the github version at that point as we can get that information out of the local assemblies (dll's).

@tidusjar tidusjar added this to the Release v1.7.0 milestone Apr 29, 2016
tidusjar referenced this issue Apr 29, 2016
…date available.

- We are now also recording the last scheduled run in the database
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant