Skip to content

Commit

Permalink
Minor updates for live coding for GIDS
Browse files Browse the repository at this point in the history
  • Loading branch information
galderz committed Apr 26, 2018
1 parent 92103c1 commit 4d460cd
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 19 deletions.
3 changes: 2 additions & 1 deletion app/src/main/java/app/AppUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ private static URL getUrl(String resource) {
}

private static Flowable<Long> throttle() {
return Flowable.interval(5, TimeUnit.MILLISECONDS).onBackpressureDrop();
// TODO live coding 1.50 - change throttle to 5 ms
return Flowable.interval(1000, TimeUnit.MILLISECONDS).onBackpressureDrop();
}

}
22 changes: 13 additions & 9 deletions app/src/main/java/app/StationBoardsVerticle.java
Original file line number Diff line number Diff line change
Expand Up @@ -177,15 +177,19 @@ public void stop(io.vertx.core.Future<Void> future) {
if (injectorDisposable != null)
injectorDisposable.dispose();

stationBoardsMap.removeContinuousQueries()
.andThen(stationBoardsMap.close())
.subscribe(
() -> {
log.info("Stopped station boards verticle");
future.complete();
}
, future::fail
);
if (stationBoardsMap != null) {
stationBoardsMap.removeContinuousQueries()
.andThen(stationBoardsMap.close())
.subscribe(
() -> {
log.info("Stopped station boards verticle");
future.complete();
}
, future::fail
);
} else {
future.complete();
}
}

}
22 changes: 13 additions & 9 deletions app/src/main/solution/app/StationBoardsVerticle.java
Original file line number Diff line number Diff line change
Expand Up @@ -164,15 +164,19 @@ public void stop(io.vertx.core.Future<Void> future) {
if (injectorDisposable != null)
injectorDisposable.dispose();

stationBoardsMap.removeContinuousQueries()
.andThen(stationBoardsMap.close())
.subscribe(
() -> {
log.info("Stopped station boards verticle");
future.complete();
}
, future::fail
);
if (stationBoardsMap != null) {
stationBoardsMap.removeContinuousQueries()
.andThen(stationBoardsMap.close())
.subscribe(
() -> {
log.info("Stopped station boards verticle");
future.complete();
}
, future::fail
);
} else {
future.complete();
}
}

}
4 changes: 4 additions & 0 deletions live-coding/gids-18.org
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ stationBoardsMap.clear()
#+BEGIN_SRC java
.flatMapCompletable(e -> stationBoardsMap.put(e.getKey(), e.getValue()))
#+END_SRC
*** Change throttle from 1000ms to 5ms
#+BEGIN_SRC java
Flowable.interval(5, TimeUnit.MILLISECONDS).onBackpressureDrop();
#+END_SRC
*** Deploy changes
#+BEGIN_SRC shell
> cd app
Expand Down

0 comments on commit 4d460cd

Please sign in to comment.