Skip to content

Commit

Permalink
expose the queue
Browse files Browse the repository at this point in the history
  • Loading branch information
Govorunb committed Jun 13, 2024
1 parent 2b39253 commit 1a73969
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
7 changes: 7 additions & 0 deletions ebs/src/modules/game/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,4 +183,11 @@ export class GameConnection {
public stressTestSetHandshake(handshake: boolean) {
this.handshake = handshake;
}

public getUnsent() {
return Array.from(this.unsentQueue);
}
public getOutstanding() {
return Array.from(this.outstandingRedeems.values());
}
}
12 changes: 11 additions & 1 deletion ebs/src/modules/game/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ app.post("/private/setresult", async (req, res) => {

app.post("/private/stress", async (req, res) => {
if (!process.env.ENABLE_STRESS_TEST) {
res.status(403).send("Disabled unless you set the ENABLE_STRESS_TEST env var");
res.status(501).send("Disabled unless you set the ENABLE_STRESS_TEST env var\nREMEMBER TO REMOVE IT FROM PROD");
return;
}

Expand All @@ -71,3 +71,13 @@ app.post("/private/stress", async (req, res) => {
startStressTest(reqObj.type, reqObj.duration, reqObj.interval);
res.sendStatus(200);
})

app.get("/private/unsent", async (req, res) => {
const unsent = connection.getUnsent();
res.send(JSON.stringify(unsent));
})

app.get("/private/outstanding", async (req, res) => {
const outstanding = connection.getOutstanding();
res.send(JSON.stringify(outstanding));
})

0 comments on commit 1a73969

Please sign in to comment.