소스 검색

Merge pull request #332 from docker/feat-sleep-ctx

Sleep cancel sleep on log follow if the user cancels
Djordje Lukic 5 년 전
부모
커밋
1b9dd7ac27
1개의 변경된 파일5개의 추가작업 그리고 1개의 파일을 삭제
  1. 5 1
      azure/aci.go

+ 5 - 1
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):
+			}
 		}
 	}
 }