Skip to content

Commit d03f2ef

Browse files
authored
feat: allow stackerdb_chunks messages to be stored in db raw events table
* feat: allow stackerdb_chunks messages to be stored in db raw events table * feat: allow proposal_response messages to be stored in db raw events table * chore: log warning on stackerdb_chunks and proposal_response messages in prod
1 parent 2b6aa6a commit d03f2ef

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

src/event-stream/event-server.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1053,6 +1053,36 @@ export async function startEventServer(opts: {
10531053
}
10541054
});
10551055

1056+
app.post('/stackerdb_chunks', async (req, res) => {
1057+
try {
1058+
await handleRawEventRequest(req);
1059+
if (isProdEnv) {
1060+
logger.warn(
1061+
'Received stackerdb_chunks message -- event not required for API operations and can cause db bloat and performance degradation in production'
1062+
);
1063+
}
1064+
await res.status(200).send({ result: 'ok' });
1065+
} catch (error) {
1066+
logger.error(error, 'error processing core-node /stackerdb_chunks');
1067+
await res.status(500).send({ error: error });
1068+
}
1069+
});
1070+
1071+
app.post('/proposal_response', async (req, res) => {
1072+
try {
1073+
await handleRawEventRequest(req);
1074+
if (isProdEnv) {
1075+
logger.warn(
1076+
'Received proposal_response message -- event not required for API operations and can cause db bloat and performance degradation in production'
1077+
);
1078+
}
1079+
await res.status(200).send({ result: 'ok' });
1080+
} catch (error) {
1081+
logger.error(error, 'error processing core-node /proposal_response');
1082+
await res.status(500).send({ error: error });
1083+
}
1084+
});
1085+
10561086
app.post('*', async (req, res) => {
10571087
await res.status(404).send({ error: `no route handler for ${req.url}` });
10581088
logger.error(`Unexpected event on path ${req.url}`);

0 commit comments

Comments
 (0)