AI Coding · Hard
The assistant parallelized calls to three downstream services. Review it.
AI CodingCode ReviewStaff
This runs inside a Spring MVC request handler at ~300 requests/second.
java
public Dashboard load(long userId) {
var profile = CompletableFuture.supplyAsync(() -> profiles.get(userId));
var orders = CompletableFuture.supplyAsync(() -> orders.recent(userId));
var recs = CompletableFuture.supplyAsync(() -> recs.forUser(userId));
return new Dashboard(profile.join(), orders.join(), recs.join());
}