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

Warn when RequestHandler doesn't invoke response.onSubscribe() #25

Closed
yschimke opened this issue May 16, 2016 · 10 comments
Closed

Warn when RequestHandler doesn't invoke response.onSubscribe() #25

yschimke opened this issue May 16, 2016 · 10 comments

Comments

@yschimke
Copy link
Member

yschimke commented May 16, 2016

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.

@ghost
Copy link

ghost commented May 16, 2016

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.

@benjchristensen
Copy link
Contributor

it increases compiled code size

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?

@yschimke
Copy link
Member Author

My concern with the mixin approach is that it relies on a n00b user doing extra work to get warned about n00b errors.

@ghost
Copy link

ghost commented May 16, 2016

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.

@ghost
Copy link

ghost commented May 16, 2016

My concern with the mixin approach is that it relies on a n00b user doing extra work to get warned about n00b errors.

Good point. Let's go with wrapper then, as we can wrap any handler provided by a user into it, without knowing runtime type.

@benjchristensen
Copy link
Contributor

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.

@benjchristensen
Copy link
Contributor

Code size is the most important on mobile

Agreed. If it's trivial though we shouldn't prevent correctness/safety guards.

@ghost
Copy link

ghost commented May 16, 2016

We should support hooking in for insights when we want, but I don't like code littered with logging everywhere just because.

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 :)

@lehecka
Copy link
Contributor

lehecka commented May 31, 2016

I would suggest relaxing the original proposal to this:
after requestHandler.handle* is called we validate that
a) response.OnSubscribe was called
b) response.OnComplete/OnError was called

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.

@lehecka
Copy link
Contributor

lehecka commented Jan 26, 2017

the most relaxed solution was implemented. onSubscribe doesn't have to be called immediately.
Closing the issue as the discussion is closed now.

@lehecka lehecka closed this as completed Jan 26, 2017
facebook-github-bot pushed a commit that referenced this issue Jul 10, 2020
…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
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

No branches or pull requests

3 participants