fix job timed out error
This commit is contained in:
@@ -23,15 +23,15 @@ implements RPCExporter{
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
publish = ( topic: string, msg: UpdateType ) => {
|
publish = async (topic: string, msg: UpdateType ) => {
|
||||||
if(!this.subs[topic]) this.subs[topic] = {}
|
if(!this.subs[topic]) this.subs[topic] = {}
|
||||||
Object.entries(this.subs[topic]).forEach(([uuid, callback]:[string, Function]) => {
|
await Promise.all(Object.entries(this.subs[topic]).map(async ([uuid, callback]:[string, Function]) => {
|
||||||
try{
|
try{
|
||||||
callback(msg)
|
await callback(msg)
|
||||||
}catch(e){
|
}catch(e){
|
||||||
delete this.subs[topic][uuid]
|
delete this.subs[topic][uuid]
|
||||||
}
|
}
|
||||||
})
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
subscribe = async (topic:string, callback:(p:UpdateType)=>any) : Promise<SubscriptionResponse<{topic: string}>> => {
|
subscribe = async (topic:string, callback:(p:UpdateType)=>any) : Promise<SubscriptionResponse<{topic: string}>> => {
|
||||||
|
|||||||
@@ -38,14 +38,14 @@ implements FrontworkComponent<ShoutboxIfc, ShoutboxFeatureIfc>, IShoutbox{
|
|||||||
this.log.push(msg)
|
this.log.push(msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
private broadcast = (uuid:string, msg: ShoutMessage) => {
|
private broadcast = async (uuid:string, msg: ShoutMessage) => {
|
||||||
Object.values(this.subs).forEach((cb:any) => {
|
await Promise.all(Object.values(this.subs).map(async (callback:any) => {
|
||||||
try{
|
try{
|
||||||
cb(msg)
|
await callback(msg)
|
||||||
}catch(e){
|
}catch(e){
|
||||||
this.unsubscribe(uuid)
|
delete this.subs[uuid]
|
||||||
}
|
}
|
||||||
})
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
getFeed = async () : Promise<ShoutMessage[]> => {
|
getFeed = async () : Promise<ShoutMessage[]> => {
|
||||||
|
|||||||
Reference in New Issue
Block a user