File tree Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Original file line number Diff line number Diff line change 8
8
connect ,
9
9
delay ,
10
10
} from "@cocalc/backend/conat/test/setup" ;
11
- import { Client , type Message } from "@cocalc/conat/core/client" ;
11
+ import type { Client , Message } from "@cocalc/conat/core/client" ;
12
12
import { wait } from "@cocalc/backend/conat/test/util" ;
13
13
14
14
beforeAll ( before ) ;
Original file line number Diff line number Diff line change @@ -604,10 +604,9 @@ export class Client extends EventEmitter {
604
604
) ;
605
605
}
606
606
timeout = Math . min ( timeout , MAX_INTEREST_TIMEOUT ) ;
607
- const response = await this . conn . timeout ( timeout ? timeout : 10000 ) . emitWithAck (
608
- "wait-for-interest" ,
609
- { subject, timeout } ,
610
- ) ;
607
+ const response = await this . conn
608
+ . timeout ( timeout ? timeout : 10000 )
609
+ . emitWithAck ( "wait-for-interest" , { subject, timeout } ) ;
611
610
if ( response . error ) {
612
611
throw new ConatError ( response . error , { code : response . code } ) ;
613
612
}
@@ -1083,9 +1082,14 @@ export class Client extends EventEmitter {
1083
1082
throw Error ( `${ name } not defined` ) ;
1084
1083
}
1085
1084
const result = await f . apply ( mesg , args ) ;
1086
- mesg . respondSync ( result ) ;
1085
+ // use await mesg.respond so waitForInterest is on, which is almost always
1086
+ // good for services.
1087
+ await mesg . respond ( result ) ;
1087
1088
} catch ( err ) {
1088
- mesg . respondSync ( null , { headers : { error : `${ err } ` } } ) ;
1089
+ await mesg . respond ( null , {
1090
+ noThrow : true , // we're not catching this one
1091
+ headers : { error : `${ err } ` } ,
1092
+ } ) ;
1089
1093
}
1090
1094
} ;
1091
1095
const loop = async ( ) => {
You can’t perform that action at this time.
0 commit comments