MCPcopy
hub / github.com/koala73/worldmonitor / fetchEvents

Method fetchEvents

src/components/TechEventsPanel.ts:27–65  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

25 }
26
27 private async fetchEvents(): Promise<void> {
28 this.loading = true;
29 this.error = null;
30 this.render();
31
32 for (let attempt = 0; attempt < 3; attempt++) {
33 try {
34 const data = await researchClient.listTechEvents({
35 type: '',
36 mappable: false,
37 days: 180,
38 limit: 100,
39 });
40 if (!data.success) throw new Error(data.error || 'Unknown error');
41
42 this.events = data.events;
43 this.setCount(data.conferenceCount);
44 this.error = null;
45
46 if (this.events.length === 0 && attempt < 2) {
47 this.showRetrying();
48 await new Promise(r => setTimeout(r, 15_000));
49 continue;
50 }
51 break;
52 } catch (err) {
53 if (this.isAbortError(err)) return;
54 if (attempt < 2) {
55 this.showRetrying();
56 await new Promise(r => setTimeout(r, 15_000));
57 continue;
58 }
59 this.error = err instanceof Error ? err.message : 'Failed to fetch events';
60 console.error('[TechEvents] Fetch error:', err);
61 }
62 }
63 this.loading = false;
64 this.render();
65 }
66
67 protected render(): void {
68 if (this.loading) {

Callers 2

constructorMethod · 0.95
refreshMethod · 0.95

Calls 6

renderMethod · 0.95
setTimeoutFunction · 0.85
setCountMethod · 0.80
showRetryingMethod · 0.80
isAbortErrorMethod · 0.80
listTechEventsMethod · 0.65

Tested by

no test coverage detected