exceed volumes and logging

This commit is contained in:
Nikita Bizyaev
2026-06-04 16:21:45 +03:00
parent e7b44539ae
commit 6dd619d621
2 changed files with 9 additions and 10 deletions

View File

@@ -3,11 +3,14 @@ import type { TopicHandler } from '../types.js'
export const TOPIC = 'data/edge5/video/v1'
export const handleEdge5Video: TopicHandler = async (topic, payload) => {
console.log('edge5.video.received', {
topic,
bytes: payload.length,
payload,
})
const BEACON_MS = 3000
let lastBeacon = 0
export const handleEdge5Video: TopicHandler = async (_topic, payload) => {
const now = Date.now()
if (now - lastBeacon >= BEACON_MS) {
console.log(`edge5.video ↑ ${payload.length}B`)
lastBeacon = now
}
onEdgeChunk(payload)
}