mirror of
https://github.com/kopia/kopia.git
synced 2026-01-03 20:17:53 -05:00
fix(kopiaui): Add timeout in pollOnce https.request equal to poll interval (#3055)
Co-authored-by: Jarek Kowalski <jaak@jkowalski.net>
This commit is contained in:
@@ -67,6 +67,8 @@ function newServerForRepo(repoID) {
|
||||
|
||||
const statusUpdated = this.raiseStatusUpdatedEvent.bind(this);
|
||||
|
||||
const pollInterval = 3000;
|
||||
|
||||
function pollOnce() {
|
||||
if (!runningServerAddress || !runningServerCertificate || !runningServerPassword || !runningServerControlPassword) {
|
||||
return;
|
||||
@@ -78,6 +80,7 @@ function newServerForRepo(repoID) {
|
||||
port: parseInt(new URL(runningServerAddress).port),
|
||||
method: "GET",
|
||||
path: "/api/v1/control/status",
|
||||
timeout: pollInterval,
|
||||
headers: {
|
||||
'Authorization': 'Basic ' + Buffer.from("server-control" + ':' + runningServerControlPassword).toString('base64')
|
||||
}
|
||||
@@ -104,7 +107,7 @@ function newServerForRepo(repoID) {
|
||||
req.end();
|
||||
}
|
||||
|
||||
const statusPollInterval = setInterval(pollOnce, 3000);
|
||||
const statusPollInterval = setInterval(pollOnce, pollInterval);
|
||||
|
||||
runningServerProcess.on('close', (code, signal) => {
|
||||
this.appendToLog(`child process exited with code ${code} and signal ${signal}`);
|
||||
|
||||
Reference in New Issue
Block a user