-
Notifications
You must be signed in to change notification settings - Fork 190
Closed
Labels
Description
Hi,
I'm using the watch to see the status of a Job in kubernetes with some code like this:
const stream = client.apis.batch.v1.watch.namespaces(namespace).jobs(jobNode.metadata.name).getStream();
const jsonStream = new JSONStream()
stream.pipe(jsonStream)
jsonStream.on('data', event => {
console.log('---- Event: ', event.type);
console.log(event.object.status);
console.log('---- END ----');
if( event.type == 'MODIFIED'){
if( event.object.status.hasOwnProperty('completionTime') ){
console.log("--- JOB COMPLETE ---");
console.log(stream);
stream.destroy();
jsonStream.destroy();
}
}
})
When the job is complete i want to close the stream and free resources but everything that i have test is not working :-( how can i stop the stream??
Best Regards.