mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
Remove more debug code
This commit is contained in:
parent
13c02b6e59
commit
7a3d2039af
1 changed files with 7 additions and 23 deletions
|
|
@ -13,15 +13,7 @@ export async function GET(request: NextRequest, { params }: { params: Promise<{
|
|||
const requestId = crypto.randomUUID()
|
||||
const stream = new SSEStream()
|
||||
const run = await findRun(Number(id))
|
||||
if (!run) {
|
||||
return new Response(`Run ${id} not found`, { status: 404 })
|
||||
}
|
||||
|
||||
const redis = await redisClient()
|
||||
if (!redis) {
|
||||
console.error(`[stream#${requestId}] Redis client not available`);
|
||||
return new Response("Internal server error", { status: 500 })
|
||||
}
|
||||
|
||||
let isStreamClosed = false
|
||||
const channelName = `evals:${run.id}`
|
||||
|
|
@ -32,22 +24,19 @@ export async function GET(request: NextRequest, { params }: { params: Promise<{
|
|||
}
|
||||
|
||||
try {
|
||||
const parsedData = JSON.parse(data)
|
||||
const taskEvent = taskEventSchema.parse(parsedData)
|
||||
const taskEvent = taskEventSchema.parse(JSON.parse(data))
|
||||
console.log(`[stream#${requestId}] task event -> ${taskEvent.eventName}`)
|
||||
const writeSuccess = await stream.write(JSON.stringify(taskEvent))
|
||||
|
||||
if (!writeSuccess) {
|
||||
console.error(`[stream#${requestId}] failed to write to stream, disconnecting`);
|
||||
await disconnect()
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(`[stream#${requestId}] invalid task event:`, data, 'Error:', error);
|
||||
} catch (_error) {
|
||||
console.error(`[stream#${requestId}] invalid task event:`, data)
|
||||
}
|
||||
}
|
||||
|
||||
const disconnect = async () => {
|
||||
console.log(`YO YO YO - [stream#${requestId}] disconnecting from channel ${channelName}`);
|
||||
if (isStreamClosed) {
|
||||
return
|
||||
}
|
||||
|
|
@ -56,24 +45,19 @@ export async function GET(request: NextRequest, { params }: { params: Promise<{
|
|||
|
||||
try {
|
||||
await redis.unsubscribe(channelName)
|
||||
console.log(`YO YO YO - [stream#${requestId}] unsubscribed from ${channelName}`);
|
||||
console.log(`[stream#${requestId}] unsubscribed from ${channelName}`)
|
||||
} catch (error) {
|
||||
console.error(`YO YO YO - [stream#${requestId}] error unsubscribing:`, error);
|
||||
console.error(`[stream#${requestId}] error unsubscribing:`, error)
|
||||
}
|
||||
|
||||
try {
|
||||
await stream.close()
|
||||
} catch (error) {
|
||||
console.error(`Error closing stream:`, error);
|
||||
console.error(`[stream#${requestId}] error closing stream:`, error)
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
await redis.subscribe(channelName, onMessage)
|
||||
} catch (error) {
|
||||
console.error(`Error subscribing to Redis:`, error);
|
||||
return new Response("Internal server error", { status: 500 })
|
||||
}
|
||||
await redis.subscribe(channelName, onMessage)
|
||||
|
||||
// Add a timeout to close the stream after a period of inactivity or errors
|
||||
const timeoutDuration = 300000; // 5 minutes
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue