-
-
Notifications
You must be signed in to change notification settings - Fork 14
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
Fixes so far #271
Fixes so far #271
Conversation
Do not attempt to parse the request body on a non-2xx response, which will almost certainly not contain what we expect. Perform the check outside of the request function, to still allow handling non-2xx responses in the rare case when it is necessary.
We can't return a HTTPClientResponse if we are going to read the data from disk.
|
Thanks for your pull request, @CyberShadow! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. Just two questions, and I think you might want to update eventcore and vibe-d along with vibe-core, as many leaks have been fixed.
source/dlangbot/github_api.d
Outdated
| else | ||
| if (res.statusCode == 200 /*OK*/) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's with the formatting ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, what specifically? The else\nif?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see this is covered by https://dlang.org/dstyle.html#phobos_whitespace, so I'll fix it.
source/dlangbot/github_api.d
Outdated
| if (res.statusCode / 100 == 3 && "Location" in res.headers) | ||
| { | ||
| auto location = res.headers["Location"]; | ||
| logInfo(" > Redirect: %s", location); | ||
| return ghGetRequest(applyRelativeURL(url, location)); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not related to caching is it ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, no. I've reused code from dtest.dlang.io. The GitHub API does return redirects in some situations (e.g. https://api.github.com/repos/D-Programming-Language/dmd ) , so I think we do need to handle them in case something gets renamed or moved around in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you split it in its own commit then ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, done.
Cache hits do not count against the API rate-limit, so it is always beneficial to do so. The caching code is reused from https://github.com/CyberShadow/DAutoTest/blob/master/github.d and https://github.com/CyberShadow/ae/blob/next/net/github/rest.d, though it omits the redirect handling code (which is also added in the following commit). Fixes dlang#166.
This implements support for redirects, which may be served by GitHub in some circumstances (such as when a repository is moved or renamed).
Avoid tasks getting stuck just because one request is stuck.
At this point, we do not yet know if this is a problem. expectOK should instead be used to convert non-2xx responses to exceptions.
Avoid another instance or thread from reading a partially-written file.
This fixes - `--cron-daily` mode eventually failing due to running out of file descriptors, because - performing repeated HTTP requests with Vibe.d causing a file descriptor leak because - Vibe.d kept erroneously dropping connections and reconnecting to the same HTTP server because - vibe.core.net.TCPConnection.waitForDataEx erroneously returning WaitForDataStatus.noMoreData instead of WaitForDataStatus.timeout in some situations because - (some unidentified bug in vibe-core fixed between 1.10.1 and 1.18.1). Update the compiler version to allow compiling the newer package as well.
- Capitalize footer, following the conventions of e.g. "Signed-off-by" - Ensure there is a blank line before the footer
By default, unit-threaded buffers and hides stdout/stderr output. This becomes a problem when an error is thrown in a unit test in a Vibe.d task. Normally, uncaught throwables are printed to stderr by a catch clause in vibe.core.task.TaskFiber.run, however, that output would be hidden by unit-threaded by default. Because vibe-core calls abort right after attempting to print the exception, we thus never get to see it. The solution is to use --debug in addition to --single, which disables output buffering in unit-threaded.
"prev" occurring before "next" was tripping up the old parser logic.
Issues are not pull requests, although the GitHub API (and UI) frequently lumps them together.
This is a batch of fixes for issues that I have encountered while moving the bot away from Heroku and onto a self-hosted system, and while fixing the daily cron job task (which has been dysfunctional for a while).
Please see the commit list and their messages for details.