From 0057093897ac54b639a6e147326b2fbffad80451 Mon Sep 17 00:00:00 2001
From: Djordje Lukic <djordje.lukic@docker.com>
Date: Fri, 3 Jul 2020 10:49:57 +0200
Subject: [PATCH] Sleep cancel sleep on log follow if the user cancels

---
 azure/aci.go | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/azure/aci.go b/azure/aci.go
index 71f2d75bb..990433e47 100644
--- a/azure/aci.go
+++ b/azure/aci.go
@@ -271,7 +271,11 @@ func streamLogs(ctx context.Context, aciContext store.AciContext, containerGroup
 				fmt.Fprintln(out, logLines[i])
 			}
 
-			time.Sleep(2 * time.Second)
+			select {
+			case <-ctx.Done():
+				return nil
+			case <-time.After(2 * time.Second):
+			}
 		}
 	}
 }