This repository has been archived by the owner on Mar 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 51
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
terinjokes
force-pushed
the
rx
branch
2 times, most recently
from
June 18, 2015 19:18
a342378
to
e038c87
Compare
} | ||
|
||
if (res.statusCode >= 400) { | ||
return observer.onError(new (errors.find(res.statusCode))('HTTP ' + res.statusCode + ': ' + url)); |
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.
url
should be currentURL
or else it'll reference the import.
Tests, tests and more test required. |
Implement observable for startkeyframerule event. |
terinjokes
force-pushed
the
rx
branch
3 times, most recently
from
August 22, 2015 00:16
41dd6d7
to
43aa4c0
Compare
@dotjs woot! this last commit finally splits the flatteners logic into separate files. |
terinjokes
force-pushed
the
rx
branch
3 times, most recently
from
September 22, 2015 18:41
b3e8bc1
to
4c8fcc6
Compare
Implemented HttpClient with needle and RxJS. Uses RxJS's recursive scheduler to handle HTTP redirects following the "forbidden" configuration. Knock-on affects throughout Collapsify to account for RxJS's Observables, for now merely being converted into Bluebird promises. The HTTP server returns JSON for errors, along with 5xx series status codes. The CLI sets an appropriate exit code.
Use the `errors` module to help standardize created errors. This allows custom errors to be defined in a single place, including a "code" property. The server has been modified to return JSON on 200 responses.
Collapsify previously assumed all requests were valid, and simply looked at the "url" query parameter on the request, with no respect giving to the path. This adds routes to the HTTP server implementation, which I use to enforce path and method restrictions. I'm also using this oppurtunity to implement two routes for collapsing a resource: the continued legacy "GET /?url=" and a new "POST /v1/collapse" with a JSON body containing a "url" property. The GET route continues to return an HTML response, whereas the new POST route returns a JSON response. The GET route is now deprecated.
Remove the manual Promise queues, "compilationQueue" and "elementQueue", and implemented them "automatically" with Observables. That is, RxJS and the computer can keep Observables in order, even when their values may be asynchronous. By using "reply", we can turn a hot observable into a cold observable, with the effect of starting these asynchronous actions, even before there's an attached subscriber to the returned observable.
The tags 'startkeyframesrule' and 'endkeygramesrule' were previously being ignored and dropped when flattening stylesheets.
Remove the manual Promise queues, "compilationQueue" and "elementQueue", and implemented them with Observables. CollapsifyDOMHandler is a custom htmlparser2 handler that generates Hot Observables once the `parse` method of htmlparser2's Parser is called. This is converted to a Cold Observable with "replay".
…epalive The HTTP client was getting "socket hang up" errors, and long pauses in responses, that seemed to be caused by an incorrect handling of open sockets in a connection pool. `yakaa` is an improved HTTP agent, specifically for keepalive sockets. However, `needle` doesn't seem to be using it properly, so it was replaced with `bhttp`.
Breaking all BDD rules, adding unit tests for the flatteners and HttpClient, testing that they seem to collapse resources while preserving errors, and that they seem to have the neccessary interdependencies required.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
CP-48 requires better communication between the Collapsify service and our internal processes to be able to give better error messages to users. The crux of this branch rests upon this requirement.
Instead of utilizing Promises to their full potential, the base branch would very quickly "catch" the failing Promises returned by the HTTP library and return a resolved Promise containing an empty Buffer. The rest of the service was centered on this behavior. :person_frowning:
This pull request refactors Collapsify onto the reactive model proposed by Reactive Extensions, and RxJS, and ensures standardized errors are returned by the Collapsify service in such a way that a client can understand the cause of the error.