mirror of
https://github.com/tale/headplane.git
synced 2026-08-21 18:26:38 +00:00
feat: switch agent to a periodic dump rather than long running process
This commit is contained in:
@@ -19,8 +19,11 @@ export async function loader({ request, context }: Route.LoaderArgs) {
|
||||
let closed = false;
|
||||
const encoder = new TextEncoder();
|
||||
const send = (event: string, data: unknown) => {
|
||||
if (!closed) {
|
||||
if (closed) return;
|
||||
try {
|
||||
controller.enqueue(encoder.encode(`event: ${event}\ndata: ${JSON.stringify(data)}\n\n`));
|
||||
} catch {
|
||||
closed = true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user