mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2024-12-20 06:07:57 +00:00
Send connection message when streaming local mode logs
Change-type: patch Signed-off-by: Cameron Diver <cameron@balena.io>
This commit is contained in:
parent
11fc93af0f
commit
06cdaddd71
@ -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…
Reference in New Issue
Block a user