rewrite consumer + testmode utils

This commit is contained in:
Emily
2025-02-01 15:26:26 +01:00
parent 4da840f2ec
commit 0963201a32
12 changed files with 135 additions and 40 deletions

View File

@@ -16,7 +16,8 @@ router.post('/keep_alive', json(jsonOptions), async (req, res) => {
const sessionHash = createSessionHash(req.body.website, ip, req.body.userAgent);
await RedisStreamService.addToStream(streamName, {
...req.body, _type: 'keep_alive', sessionHash, ip,
instant: req.body.instant + ''
instant: req.body.instant + '',
timestamp: Date.now()
});
return res.sendStatus(200);
} catch (ex: any) {
@@ -38,12 +39,14 @@ router.post('/metrics/push', json(jsonOptions), async (req, res) => {
...req.body, _type: 'visit', sessionHash, ip,
screenWidth: '0',
screenHeight: '0',
type: req.body.type.toString()
type: req.body.type.toString(),
timestamp: Date.now()
});
} else {
await RedisStreamService.addToStream(streamName, {
...req.body, _type: 'event', sessionHash, ip,
type: req.body.type.toString()
type: req.body.type.toString(),
timestamp: Date.now()
});
}