Skip to content

Commit 25331fb

Browse files
author
Dushyant Bhalgami
committed
hot fix for memroy leak
1 parent 331b0db commit 25331fb

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

app.js

+13
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const swaggerUi = require('swagger-ui-express')
1818
const YAML = require('yamljs')
1919
const authenticator = require('tc-core-library-js').middleware.jwtAuthenticator
2020
const fileUpload = require('express-fileupload')
21+
const memwatch = require('memwatch-next')
2122

2223
const swaggerDocument = YAML.load('./docs/swagger.yaml')
2324
const app = express()
@@ -30,6 +31,18 @@ app.use(bodyParser.urlencoded({ limit: '50mb', extended: true }))
3031
app.use(cors())
3132
app.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+
3346
const apiRouter = express.Router()
3447

3548
/**

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
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",

0 commit comments

Comments
 (0)