Browser timeout fixes

This commit is contained in:
crschnick 2024-07-12 13:51:33 +00:00
parent 18b6fa0338
commit 67762a976b
3 changed files with 10 additions and 8 deletions

View file

@ -58,8 +58,8 @@ public class BrowserStatusBarComp extends SimpleComp {
return null;
} else {
var expected = p.expectedTimeRemaining();
var show = (p.getTotal() > 50_000_000 && p.elapsedTime().compareTo(Duration.of(200, ChronoUnit.MILLIS)) > 0) || expected.toMillis() > 5000;
var time = show ? HumanReadableFormat.duration(p.expectedTimeRemaining()) : "...";
var show = p.elapsedTime().compareTo(Duration.of(200, ChronoUnit.MILLIS)) > 0 && (p.getTotal() > 50_000_000 || expected.toMillis() > 5000);
var time = show ? HumanReadableFormat.duration(p.expectedTimeRemaining()) : "";
return time;
}
});

View file

@ -8,6 +8,7 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.nio.charset.Charset;
import java.time.Duration;
import java.util.Optional;
import java.util.function.Consumer;
import java.util.function.Function;
@ -59,6 +60,8 @@ public interface CommandControl extends ProcessControl {
OutputStream startExternalStdin() throws Exception;
public void setExitTimeout(Duration duration);
boolean waitFor();
CommandControl withCustomCharset(Charset charset);

View file

@ -1,13 +1,13 @@
package io.xpipe.core.store;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.xpipe.core.process.CommandBuilder;
import io.xpipe.core.process.ShellControl;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Getter;
import java.io.InputStream;
import java.io.OutputStream;
import java.time.Duration;
import java.util.List;
import java.util.Optional;
import java.util.stream.Stream;
@ -53,10 +53,9 @@ public class ConnectionFileSystem implements FileSystem {
@Override
public OutputStream openOutput(String file, long totalBytes) throws Exception {
return shellControl
.getShellDialect()
.createStreamFileWriteCommand(shellControl, file, totalBytes)
.startExternalStdin();
var cmd = shellControl.getShellDialect().createStreamFileWriteCommand(shellControl, file, totalBytes);
cmd.setExitTimeout(Duration.ofMillis(Long.MAX_VALUE));
return cmd.startExternalStdin();
}
@Override