Skip to content

Commit

Permalink
fix(k8s): ensure get logs handler resolves
Browse files Browse the repository at this point in the history
In the case of no pods being found for a given service, the getPodLogs
promise would never resolve, causing the process to not exit properly.
  • Loading branch information
eysi09 committed Oct 2, 2019
1 parent 923aa02 commit 4763532
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions garden-service/src/plugins/kubernetes/logs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ export async function getPodLogs(params: GetPodLogsParams) {
const procs = await Bluebird.map(params.pods, pod => getLogs({ ...omit(params, "pods"), pod }))

return new Promise<GetServiceLogsResult>((resolve, reject) => {
// Make sure to resolve if no processes get created
if (procs.length === 0) {
return resolve({})
}
for (const proc of procs) {
proc.on("error", reject)

Expand Down

0 comments on commit 4763532

Please sign in to comment.