File tree 2 files changed +8
-4
lines changed
2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change 16
16
* You should have received a copy of the GNU Affero General Public License
17
17
* along with this program. If not, see <https://www.gnu.org/licenses/>.
18
18
*/
19
+ const { Context } = require ( "../util/context" ) ;
19
20
const BaseService = require ( "./BaseService" ) ;
20
21
21
22
class ScopedEventBus {
@@ -55,7 +56,7 @@ class EventService extends BaseService {
55
56
56
57
// IIAFE wrapper to catch errors without blocking
57
58
// event dispatch.
58
- ( async ( ) => {
59
+ Context . arun ( async ( ) => {
59
60
try {
60
61
await callback ( key , data , meta ) ;
61
62
} catch ( e ) {
@@ -65,14 +66,14 @@ class EventService extends BaseService {
65
66
alarm : true ,
66
67
} ) ;
67
68
}
68
- } ) ( ) ;
69
+ } ) ;
69
70
}
70
71
}
71
72
72
73
for ( const callback of this . global_listeners_ ) {
73
74
// IIAFE wrapper to catch errors without blocking
74
75
// event dispatch.
75
- ( async ( ) => {
76
+ Context . arun ( async ( ) => {
76
77
try {
77
78
await callback ( key , data , meta ) ;
78
79
} catch ( e ) {
@@ -82,7 +83,7 @@ class EventService extends BaseService {
82
83
alarm : true ,
83
84
} ) ;
84
85
}
85
- } ) ( ) ;
86
+ } ) ;
86
87
}
87
88
88
89
}
Original file line number Diff line number Diff line change @@ -60,6 +60,9 @@ class Context {
60
60
static describe ( ) {
61
61
return this . get ( ) . describe ( ) ;
62
62
}
63
+ static arun ( cb ) {
64
+ return this . get ( ) . arun ( cb ) ;
65
+ }
63
66
get ( k ) {
64
67
return this . values_ [ k ] ;
65
68
}
You can’t perform that action at this time.
0 commit comments