Skip to content

Commit

Permalink
Add some logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Quantumplation committed Dec 10, 2024
1 parent f66b932 commit 3056a38
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions referee/referee.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,23 +55,26 @@ async function sendEvent(gameId, data) {
}

async function reportResults(gameId, results) {
console.log(`Reporting results for game ${gameId}\n`, JSON.stringify(results, null, 2));
for(let i = 0; i < 5; i++) {
for(let i = 0; i < 10; i++) {
console.log(`Reporting results for game ${gameId}\n`, JSON.stringify(results, null, 2));
try {
console.log("Sending to dynamodb");
await dynamo.send(new PutItemCommand({
TableName: "doom-game-results",
Item: {
pk: { S: gameId },
results: { S: JSON.stringify(results) },
},
}));
console.log("Sending to discord bot");
let resp = await fetch(DISCORD_BOT, {
method: "POST",
body: JSON.stringify(results),
})
});
if (resp.status !== 200) {
throw new Error(resp.statusText + ": " + await resp.text());
} else {
console.log("Success!");
break;
}
} catch(e) {
Expand Down

0 comments on commit 3056a38

Please sign in to comment.