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

Fix Premature Unsubscribe Bug #296

Merged
merged 1 commit into from
Aug 27, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions hystrix-core/src/main/java/com/netflix/hystrix/HystrixCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,7 @@ public HystrixCommand<R> getCommand() {

@Override
public void call(Subscriber<? super R> observer) {
originalObservable.subscribe(observer);
originalObservable.unsafeSubscribe(observer);
}
});
this.command = command;
Expand Down Expand Up @@ -1077,7 +1077,7 @@ public int getIntervalTimeInMilliseconds() {
// set externally so execute/queue can see this
originalCommand.timeoutTimer.set(tl);

o.subscribe(new Subscriber<R>(observer) {
o.unsafeSubscribe(new Subscriber<R>(observer) {

@Override
public void onCompleted() {
Expand Down Expand Up @@ -6184,6 +6184,20 @@ public void call(Throwable t1) {
assertEquals(1, HystrixRequestLog.getCurrentRequest().getExecutedCommands().size());
}

@Test(timeout=1000)
public void testResponseFlatMappable() {
Observable<Boolean> result = new SuccessfulTestCommand().toObservable()
.flatMap(new Func1<Boolean, Observable<Boolean>>() {

@Override
public Observable<Boolean> call(Boolean t1) {
return new SuccessfulTestCommand().toObservable();
}

});
System.out.println("result (toObservable) = " + result.toBlockingObservable().single());
}

/* ******************************************************************************** */
/* ******************************************************************************** */
/* private HystrixCommand class implementations for unit testing */
Expand Down