File tree 2 files changed +43
-1
lines changed
2 files changed +43
-1
lines changed Original file line number Diff line number Diff line change @@ -125,7 +125,7 @@ inline bool OtherIsInt(Napi::Number source) {
125
125
if ((argc != 0 ) && (passed_argv != NULL )) {\
126
126
args.assign (passed_argv, passed_argv + argc);\
127
127
}\
128
- Napi::Value res = (callback).MakeCallback (Napi::Value(context), args); \
128
+ Napi::Value res = (callback).Call (Napi::Value(context), args); \
129
129
if (res.IsEmpty()) return __VA_ARGS__;
130
130
131
131
#define WORK_DEFINITION (name ) \
Original file line number Diff line number Diff line change
1
+ "use strict"
2
+
3
+ var sqlite3 = require ( '..' ) ;
4
+ const assert = require ( "assert" ) ;
5
+ const { createHook, executionAsyncId } = require ( "async_hooks" ) ;
6
+
7
+
8
+ describe ( 'async_hooks' , function ( ) {
9
+ let db ;
10
+ let dbId ;
11
+ let asyncHook ;
12
+
13
+ beforeEach ( function ( ) {
14
+ db = new sqlite3 . Database ( ':memory:' ) ;
15
+
16
+ asyncHook = createHook ( {
17
+ init ( asyncId , type ) {
18
+ if ( dbId == null && type . startsWith ( "sqlite3." ) ) {
19
+ dbId = asyncId ;
20
+ }
21
+ }
22
+ } ) . enable ( ) ;
23
+ } ) ;
24
+
25
+ it ( 'should support performance measuring with async hooks' , function ( done ) {
26
+ db . run ( "DROP TABLE user" , ( ) => {
27
+ const cbId = executionAsyncId ( ) ;
28
+ assert . strictEqual ( cbId , dbId ) ;
29
+ done ( ) ;
30
+ } ) ;
31
+ } ) ;
32
+
33
+ afterEach ( function ( ) {
34
+ if ( asyncHook != null ) {
35
+ asyncHook . disable ( ) ;
36
+ }
37
+ dbId = null ;
38
+ if ( db != null ) {
39
+ db . close ( ) ;
40
+ }
41
+ } ) ;
42
+ } ) ;
You can’t perform that action at this time.
0 commit comments