Skip to content

Commit

Permalink
fix(kopiaui): Add timeout in pollOnce https.request equal to poll int…
Browse files Browse the repository at this point in the history
…erval (kopia#3055)

Co-authored-by: Jarek Kowalski <jaak@jkowalski.net>
  • Loading branch information
riedel and jkowalski committed Feb 21, 2024
1 parent ca2230f commit c6536df
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/public/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ function newServerForRepo(repoID) {

const statusUpdated = this.raiseStatusUpdatedEvent.bind(this);

const pollInterval = 3000;

function pollOnce() {
if (!runningServerAddress || !runningServerCertificate || !runningServerPassword || !runningServerControlPassword) {
return;
Expand All @@ -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')
}
Expand All @@ -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}`);
Expand Down

0 comments on commit c6536df

Please sign in to comment.