Skip to content

Commit 0e255e4

Browse files
committed
Merge pull request signalapp#33 from backspace/break-current-commit-price-cache
Serve current commit price with no caching
2 parents 253700d + ea0811f commit 0e255e4

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/main/java/org/whispersystems/bithub/controllers/StatusController.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import javax.ws.rs.GET;
3232
import javax.ws.rs.Path;
3333
import javax.ws.rs.QueryParam;
34+
import javax.ws.rs.core.CacheControl;
3435
import javax.ws.rs.core.MediaType;
3536
import javax.ws.rs.core.Response;
3637
import java.io.IOException;
@@ -83,12 +84,15 @@ public RecentTransactionsView getTransactions()
8384
public Response getCurrentCommitPrice(@QueryParam("format") @DefaultValue("png") String format)
8485
throws IOException
8586
{
87+
CacheControl cacheControl = new CacheControl();
88+
cacheControl.setNoCache(true);
89+
8690
if (format.equals("json")) {
87-
return Response.ok(cachedPaymentStatus.get().getEntity(), MediaType.APPLICATION_JSON_TYPE).build();
91+
return Response.ok(cachedPaymentStatus.get().getEntity(), MediaType.APPLICATION_JSON_TYPE).cacheControl(cacheControl).build();
8892
} else if (format.equals("png_small")) {
89-
return Response.ok(cachedPaymentStatus.get().getSmallBadge(), "image/png").build();
93+
return Response.ok(cachedPaymentStatus.get().getSmallBadge(), "image/png").cacheControl(cacheControl).build();
9094
} else {
91-
return Response.ok(cachedPaymentStatus.get().getBadge(), "image/png").build();
95+
return Response.ok(cachedPaymentStatus.get().getBadge(), "image/png").cacheControl(cacheControl).build();
9296
}
9397
}
9498

0 commit comments

Comments
 (0)