We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see ourdocumentation.
There was an error while loading.Please reload this page.
1 parentb71a229 commit9da3ad7Copy full SHA for 9da3ad7
backend/src/index.ts
@@ -9,15 +9,20 @@ import { eventInfo, eventInfoMutex, fetchEvents } from "./data/eventData";
9
dotenv.config();
10
11
(async()=>{
12
-try{
13
-constevents=awaitfetchEvents();
14
-eventInfoMutex.runExclusive(()=>eventInfo.push(...events));
15
-console.log("Events fetched successfully");
16
-}catch(error){
17
-// do we ungracefully bail out here???
18
-// could just load from a backup file instead
19
-console.error("Error fetching events on startup:",error);
20
-}
+setInterval(()=>{
+try{
+constevents=awaitfetchEvents();
+eventInfoMutex.runExclusive(()=>{
+eventInfo.length=0;
+eventInfo.push(...events);
+});
+console.log("Events fetched successfully");
+}catch(error){
21
+// do we ungracefully bail out here???
22
+// could just load from a backup file instead
23
+console.error("Error fetching events:",error);
24
+}
25
+},30*60*1000);
26
27
constapp:Express=express();
28
constport=process.env.PORT||9000;