mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-03-23 12:35:44 +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
|
||||
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);
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user