Added handling for last_update messages

This commit is contained in:
Luke Steyn
2023-11-22 15:49:51 +01:00
parent 80a50c1eb0
commit a24757f374

View File

@@ -166,12 +166,17 @@ async function main() {
// Fetch and send last message
if (redisChannel.includes('orderbook')) {
const lastUpdateChannel = `last_update_${redisChannel}`;
const lastMessage = await lastMessageRetriever.client.get(
`last_update_${redisChannel}`
lastUpdateChannel
);
if (lastMessage !== null) {
ws.send(
JSON.stringify({ channel: redisChannel, data: lastMessage })
JSON.stringify({
channel: lastUpdateChannel,
data: lastMessage,
})
);
}
}