mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-06-01 23:30:48 +00:00
Merge pull request #869 from balena-io/seed-initial-logs
Send connection message when streaming local mode logs
This commit is contained in:
commit
37725a8e60
@ -327,6 +327,13 @@ export function createV2Api(router: Router, applications: ApplicationManager) {
|
|||||||
// Get the stream, and stream it into res
|
// Get the stream, and stream it into res
|
||||||
const listenStream = backend.attachListener();
|
const listenStream = backend.attachListener();
|
||||||
|
|
||||||
|
// The http connection doesn't correctly intialise until some data is sent,
|
||||||
|
// which means any callers waiting on the data being returned will hang
|
||||||
|
// until the first logs comes through. To avoid this we send an initial
|
||||||
|
// message
|
||||||
|
res.write(
|
||||||
|
`${JSON.stringify({ message: 'Streaming logs', isSystem: true })}\n`,
|
||||||
|
);
|
||||||
listenStream.pipe(res);
|
listenStream.pipe(res);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user