File tree 2 files changed +15
-0
lines changed
2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ const swaggerUi = require('swagger-ui-express')
18
18
const YAML = require ( 'yamljs' )
19
19
const authenticator = require ( 'tc-core-library-js' ) . middleware . jwtAuthenticator
20
20
const fileUpload = require ( 'express-fileupload' )
21
+ const memwatch = require ( 'memwatch-next' )
21
22
22
23
const swaggerDocument = YAML . load ( './docs/swagger.yaml' )
23
24
const app = express ( )
@@ -30,6 +31,19 @@ app.use(bodyParser.urlencoded({ limit: '50mb', extended: true }))
30
31
app . use ( cors ( ) )
31
32
app . use ( fileUpload ( ) )
32
33
34
+ memwatch . on ( 'leak' , function ( info ) {
35
+ winston . info ( `Memory leak detected, details: ${ info } ` )
36
+ const reqBody = {
37
+ topic : 'common.error.reporting' ,
38
+ originator : 'submission-api' ,
39
+ timestamp : ( new Date ( ) ) . toISOString ( ) , // time when submission was created
40
+ 'mime-type' : 'application/json' ,
41
+ payload : info
42
+ }
43
+
44
+ helper . postToBusApi ( reqBody )
45
+ } )
46
+
33
47
const apiRouter = express . Router ( )
34
48
35
49
/**
Original file line number Diff line number Diff line change 37
37
"http-status" : " ^1.2.0" ,
38
38
"joi" : " ^13.4.0" ,
39
39
"lodash" : " ^4.17.15" ,
40
+ "memwatch-next" : " ^0.3.0" ,
40
41
"superagent" : " ^3.8.3" ,
41
42
"swagger-ui-express" : " ^3.0.10" ,
42
43
"tc-bus-api-wrapper" : " topcoder-platform/tc-bus-api-wrapper.git#feature/auth0-proxy-server" ,
You can’t perform that action at this time.
0 commit comments