Skip to content

Commit

Permalink
XX test coverage of credentials.js watch
Browse files Browse the repository at this point in the history
  • Loading branch information
martinpitt committed Nov 6, 2024
1 parent c47e024 commit ed9c20f
Showing 1 changed file with 0 additions and 29 deletions.
29 changes: 0 additions & 29 deletions pkg/lib/credentials.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,35 +43,6 @@ function Keys() {
});

function refresh() {
function on_message(ev, payload) {
const item = JSON.parse(payload);
const name = item.path;
if (name && name.indexOf("/") === -1 && name.slice(-4) === ".pub") {
if (item.event === "present" || item.event === "created" ||
item.event === "changed" || item.event === "deleted") {
window.clearInterval(timeout);
timeout = window.setTimeout(refresh, 100);
}
}
}

function on_close(ev, data) {
watch.removeEventListener("close", on_close);
watch.removeEventListener("message", on_message);
if (!data.problem || data.problem == "not-found") {
watch = null; /* Watch again */
} else {
console.warn("couldn't watch " + self.path + ": " + (data.message || data.problem));
watch = false; /* Don't watch again */
}
}

if (watch === null) {
watch = cockpit.channel({ payload: "fswatch1", path: self.path });
watch.addEventListener("close", on_close);
watch.addEventListener("message", on_message);
}

if (proc)
return;

Expand Down

0 comments on commit ed9c20f

Please sign in to comment.