Bladeren bron

fix job timed out error

master
peter 5 jaren geleden
bovenliggende
commit
dad45d4f56

+ 4
- 4
src/backend/Components/PubSub/PubSub.ts Bestand weergeven

@@ -23,15 +23,15 @@ implements RPCExporter{
23 23
         }
24 24
     ]
25 25
 
26
-    publish = ( topic: string, msg: UpdateType ) => {
26
+    publish = async (topic: string, msg: UpdateType ) => {
27 27
         if(!this.subs[topic]) this.subs[topic] = {}
28
-        Object.entries(this.subs[topic]).forEach(([uuid, callback]:[string, Function]) => {
28
+        await Promise.all(Object.entries(this.subs[topic]).map(async ([uuid, callback]:[string, Function]) => {
29 29
             try{
30
-                callback(msg)
30
+                await callback(msg)
31 31
             }catch(e){
32 32
                 delete this.subs[topic][uuid]
33 33
             }
34
-        })
34
+        }))
35 35
     }
36 36
 
37 37
     subscribe = async (topic:string, callback:(p:UpdateType)=>any) : Promise<SubscriptionResponse<{topic: string}>> => {

+ 5
- 5
src/backend/Components/Shoutbox/Shoutbox.ts Bestand weergeven

@@ -38,14 +38,14 @@ implements FrontworkComponent<ShoutboxIfc, ShoutboxFeatureIfc>, IShoutbox{
38 38
         this.log.push(msg)
39 39
     }
40 40
 
41
-    private broadcast = (uuid:string, msg: ShoutMessage) => {
42
-        Object.values(this.subs).forEach((cb:any) => {
41
+    private broadcast = async (uuid:string, msg: ShoutMessage) => {
42
+        await Promise.all(Object.values(this.subs).map(async (callback:any) => {
43 43
             try{
44
-                cb(msg)
44
+                await callback(msg)
45 45
             }catch(e){
46
-                this.unsubscribe(uuid)
46
+                delete this.subs[uuid]
47 47
             }
48
-        })
48
+        }))
49 49
     }
50 50
 
51 51
     getFeed = async () : Promise<ShoutMessage[]> => {

+ 3
- 3
src/frontend/src/app/frontcraft/pages/pages-layout.component.ts Bestand weergeven

@@ -27,9 +27,9 @@ export class PagesLayoutComponent implements AfterContentInit{
27 27
     title: 'Loot Rules',
28 28
     link: '/frontcraft/rules',
29 29
   },{
30
-  icon: "shield",
31
-  title: 'Armory',
32
-  link: '/frontcraft/armory'
30
+    icon: "shield",
31
+    title: 'Armory',
32
+    link: '/frontcraft/armory'
33 33
   }]
34 34
   
35 35
   constructor(

Laden…
Annuleren
Opslaan