Skip to content
This repository was archived by the owner on Jun 27, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,9 @@ async function handleGetSingleScheduledRewards (req, res, redis) {
}

async function handleGetLog (res, redis) {
const log = []
res.setHeader('Content-Type', 'application/json')
res.write('[')

// Fetch logs in batches to avoid upstash request size limit
// https://upstash.com/docs/redis/troubleshooting/max_request_size_exceeded
let offset = 0
Expand All @@ -283,12 +285,11 @@ async function handleGetLog (res, redis) {
if (batch.length === 0) {
break
}
log.push(...batch)
offset += batchSize
res.write(batch.join(','))
}

res.setHeader('Content-Type', 'application/json')
res.end(`[${log.join(',')}]`)
res.end(']')
}

const errorHandler = (res, err, logger) => {
Expand Down