Skip to content

Commit

Permalink
refs #18: fix wrong usage around Observable
Browse files Browse the repository at this point in the history
  • Loading branch information
KengoTODA committed Oct 29, 2016
1 parent d7d84b5 commit 04bfa90
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions legacy/src/main/java/jp/skypencil/brownie/FrontendServer.java
Expand Up @@ -185,10 +185,13 @@ private void deleteFile(RoutingContext ctx, String fileId) {
Future<Void> closed = Future.future();
createHttpClientForFileStorage(closed)
.flatMap(client -> {
HttpClientRequest req = client.delete("/file/" + fileId);
Observable<HttpClientResponse> result = req.toObservable();
req.end();
return result.toSingle();
Observable<HttpClientResponse> observable = Observable.create(subscriber -> {
HttpClientRequest clientReq = client.delete("/file/" + fileId);
Observable<HttpClientResponse> clientRes = clientReq.toObservable();
clientRes.subscribe(subscriber);
clientReq.end();
});
return observable.toSingle();
})
.doAfterTerminate(closed::complete)
.subscribe(clientRes -> {
Expand Down

0 comments on commit 04bfa90

Please sign in to comment.