File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ const swaggerUi = require('swagger-ui-express')
1818const YAML = require ( 'yamljs' )
1919const authenticator = require ( 'tc-core-library-js' ) . middleware . jwtAuthenticator
2020const fileUpload = require ( 'express-fileupload' )
21+ const memwatch = require ( 'memwatch-next' )
2122
2223const swaggerDocument = YAML . load ( './docs/swagger.yaml' )
2324const app = express ( )
@@ -30,6 +31,18 @@ app.use(bodyParser.urlencoded({ limit: '50mb', extended: true }))
3031app . use ( cors ( ) )
3132app . use ( fileUpload ( ) )
3233
34+ memwatch . on ( 'leak' , function ( info ) {
35+ const reqBody = {
36+ topic : 'common.error.reporting' ,
37+ originator : 'submission-api' ,
38+ timestamp : ( new Date ( ) ) . toISOString ( ) , // time when submission was created
39+ 'mime-type' : 'application/json' ,
40+ payload : info
41+ }
42+
43+ helper . postToBusApi ( reqBody )
44+ } )
45+
3346const apiRouter = express . Router ( )
3447
3548/**
Original file line number Diff line number Diff line change 3737 "http-status" : " ^1.2.0" ,
3838 "joi" : " ^13.4.0" ,
3939 "lodash" : " ^4.17.15" ,
40+ "memwatch-next" : " ^0.3.0" ,
4041 "superagent" : " ^3.8.3" ,
4142 "swagger-ui-express" : " ^3.0.10" ,
4243 "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