@pi-unipi/info-screen 0.1.8 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/tui/info-overlay.ts +13 -5
package/package.json
CHANGED
package/tui/info-overlay.ts
CHANGED
|
@@ -87,13 +87,21 @@ export class InfoOverlay implements Component {
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
try {
|
|
90
|
-
// Load data for all groups in parallel
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
90
|
+
// Load data for all groups in parallel with timeout
|
|
91
|
+
const loadPromises = this.groups.map(async (group) => {
|
|
92
|
+
try {
|
|
93
|
+
const data = await Promise.race([
|
|
94
|
+
infoRegistry.getGroupData(group.id),
|
|
95
|
+
new Promise<never>((_, reject) => setTimeout(() => reject(new Error('timeout')), 3000)),
|
|
96
|
+
]);
|
|
97
|
+
this.groupData.set(group.id, data);
|
|
98
|
+
} catch {
|
|
99
|
+
// Use empty data on timeout/error
|
|
100
|
+
this.groupData.set(group.id, {});
|
|
101
|
+
}
|
|
94
102
|
});
|
|
95
103
|
|
|
96
|
-
await Promise.all(
|
|
104
|
+
await Promise.all(loadPromises);
|
|
97
105
|
} catch (error) {
|
|
98
106
|
this.error = error instanceof Error ? error.message : String(error);
|
|
99
107
|
}
|