Merge remote-tracking branch 'origin/master' into eliminate-gst-from-app-paths

This commit is contained in:
Janne Savolainen committed 2022-01-14 07:59:42 +02:00
commit 00f6d6bc1f
8 files changed
+29 -86

No files matched your search

@@ -48,31 +48,18 @@ export class PortForwardStore extends ItemStore<PortForwardItem> {
const savedPortForwards = this.dependencies.storage.get(); // undefined on first load
if (Array.isArray(savedPortForwards)) {
if (Array.isArray(savedPortForwards) && savedPortForwards.length > 0) {
logger.info("[PORT-FORWARD-STORE] starting saved port-forwards");
// add the disabled ones
await Promise.all(
savedPortForwards
.filter((pf) => pf.status === "Disabled")
.map(this.add),
);
await Promise.all(savedPortForwards.filter(pf => pf.status === "Disabled").map(this.add));
// add the active ones and check if they started successfully
const results = await Promise.allSettled(
savedPortForwards
.filter((pf) => pf.status === "Active")
.map(this.add),
);
// add the active ones (assume active if the status is undefined, for backward compatibility) and check if they started successfully
const results = await Promise.allSettled(savedPortForwards.filter(pf => !pf.status || pf.status === "Active").map(this.add));
for (const result of results) {
if (
result.status === "rejected" ||
result.value.status === "Disabled"
) {
notifyErrorPortForwarding(
"One or more port-forwards could not be started",
);
if (result.status === "rejected" || result.value.status === "Disabled") {
notifyErrorPortForwarding("One or more port-forwards could not be started");
return;
}