-
Notifications
You must be signed in to change notification settings - Fork 99
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
Warn when RequestHandler doesn't invoke response.onSubscribe() #25
Comments
Hmm, can we implement a wrapper around RequestHandler, or better: a mixin, that checks this assertion? It might seem like a trivial check, but it increases compiled code size and is not something we want in prod, I suppose. |
I'm struggling to see why this is a concern. I buy that it may not be a check we care about, but why is "compiled code size" a big deal here? And how much increase are we talking about? |
My concern with the mixin approach is that it relies on a n00b user doing extra work to get warned about n00b errors. |
Code size is the most important on mobile, I think. It won't be a big change for this particular class, as it's used in a few spots only. I don't know how big deal it would be for this class, but my wild guess is that logging is responsible for as much code in Channel{Responder,Requester} as actual functionality. Most importantly, it's easy to avoid. |
Good point. Let's go with wrapper then, as we can wrap any handler provided by a user into it, without knowing runtime type. |
Regarding logging, the entire RxJava library has no logging, so I'm quite alright with us avoiding what is generally just a waste of space. We should support hooking in for insights when we want, but I don't like code littered with logging everywhere just because. |
Agreed. If it's trivial though we shouldn't prevent correctness/safety guards. |
Mixin/wrapper-based approach provides nice separation between logic and logging. Look at the amount of debug logging we already have and compare it with the number of LOG(...) statements in the code. I'd say it's quite good ratio :) |
I would suggest relaxing the original proposal to this: This will simplify writing the handler for the cases when the handler wants to terminate right away. The subscription object is unnecessary for sending the terminating signal. |
the most relaxed solution was implemented. onSubscribe doesn't have to be called immediately. |
…eps (#25) Summary: Fixes include: 1. Passing "GETDEPS_BUILD_DIR" and "GETDEPS_INSTALL_DIR" env variable and using them in eden/scm/Makefile rather than assuming the source code is always in the same place regardless getdeps arguments (it isn't). 2. Added "fbthrift-source" and "fb303-source" to avoid unnecessary compilation (at least of fb303) and to put fbthrift and fb303 source code in an easy to locate place inside getdeps' "installed" folder. Pull Request resolved: facebook/sapling#25 Test Plan: sandcastle, check oss-eden_scm-darwin-getdeps Reviewed By: farnz Differential Revision: D22431872 Pulled By: lukaspiatkowski fbshipit-source-id: 8ccbb090713ec085a5dd56df509eb58ab6fb9e34
Can we detect this after requestHandler.handle*() is called and print a warning or fail noisily and early? At least during development this should be the default.
production behaviour to be discussed.
The text was updated successfully, but these errors were encountered: