File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
util/src/main/java/io/kubernetes/client/util Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -244,6 +244,10 @@ private class WebSocketOutputStream extends OutputStream {
244244
245245 private static final int WAIT_MILLIS = 10 ;
246246
247+ private static final int FLUSH_WAIT_MILLIS = 1 ;
248+
249+ private static final int MAX_FLUSH_ITERATIONS = MAX_WAIT_MILLIS / FLUSH_WAIT_MILLIS ;
250+
247251 private final byte stream ;
248252
249253 public WebSocketOutputStream (int stream ) {
@@ -272,11 +276,11 @@ public void flush() throws IOException {
272276 int i = 0 ;
273277 while (WebSocketStreamHandler .this .socket .queueSize () > 0 ) {
274278 try {
275- Thread .sleep (100 );
279+ Thread .sleep (FLUSH_WAIT_MILLIS );
276280 } catch (InterruptedException ex ) {
277281 }
278282 // Wait a maximum of 10 seconds.
279- if (i ++ > 100 ) {
283+ if (i ++ > MAX_FLUSH_ITERATIONS ) {
280284 throw new IOException ("Timed out waiting for web-socket to flush." );
281285 }
282286 }
You can’t perform that action at this time.
0 commit comments