-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
Merge Job into Call. CallTest = AsyncApiTest + SyncApiTest #764
Conversation
CallTest now has a lot of duplication.. we can either pick through it now, or later. |
*/ | ||
public Response execute(Request request) throws IOException { | ||
public Call newCall(Request request) { |
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 like this much better.
cc @jhump |
} | ||
|
||
try { | ||
call.execute(callback); |
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.
fail
LGTM |
OK! updated to make blocking calls cancelable with tests. PTAL |
Merge Job into Call. CallTest = AsyncApiTest + SyncApiTest
} | ||
}); | ||
|
||
Thread.sleep(100); // wait for it to go in flight. |
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.
To avoid test flakiness (and potentially make this faster since often it won't even take 100 millis to do), I prefer to use latches to coordinate the main test thread and the async action.
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 don't think we can access a good spot to place such a latch. Here, we are looking at ensuring the http engine is initialized to avoid a quick exit. Without making a state loop on visibility of a protected field, I think a 100ms is next best, and as you mentioned, significantly long enough to avoid being flakey.
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.
Ok. I was thinking it could be in the above submitted task, but I now see why that doesn't suffice.
One call to rule them all.