File tree Expand file tree Collapse file tree 3 files changed +20
-3
lines changed
Expand file tree Collapse file tree 3 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ Api.prototype.start = function (cb) {
2424 // start github ssh key generator
2525 keyGen . start ( ) ;
2626 // start sending socket count
27- dogstatsd . captureSocketCount ( ) ;
27+ dogstatsd . monitorStart ( ) ;
2828
2929 var count = createCount ( callback ) ;
3030 // connect to mongoose
@@ -69,6 +69,8 @@ Api.prototype.stop = function (cb) {
6969 var count = createCount ( cb ) ;
7070 // stop github ssh key generator
7171 keyGen . stop ( ) ;
72+ // stop sending socket count
73+ dogstatsd . monitorStart ( ) ;
7274 // express server
7375 mongooseControl . stop ( count . inc ( ) . next ) ;
7476 events . close ( count . inc ( ) . next ) ;
Original file line number Diff line number Diff line change @@ -44,3 +44,4 @@ POLL_MONGO_TIMEOUT="30 minutes"
4444GITHUB_SCOPE = " user:email,repo,repo_deployment,read:repo_hook"
4545GITHUB_HOOK_SECRET = " 3V3RYTHINGisAW3S0ME!"
4646DOCKER_IMAGE_BUILDER_CACHE = " /git-cache"
47+ MONITOR_INTERVAL = " 1 minute"
Original file line number Diff line number Diff line change @@ -39,8 +39,22 @@ function captureSocketCount () {
3939 if ( err ) { return ; }
4040 client . gauge ( 'api.openFiles' , parseInt ( stdout ) , 1 , [ 'pid:' + process . pid ] ) ;
4141 } ) ;
42- setTimeout ( captureSocketCount , 60000 ) ;
42+ }
43+
44+ var interval ;
45+
46+ function monitorStart ( ) {
47+ if ( interval ) { return ; }
48+ interval = setInterval ( captureSocketCount , process . env . MONITOR_INTERVAL ) ;
49+ }
50+
51+ function monitorStop ( ) {
52+ if ( interval ) {
53+ clearInterval ( interval ) ;
54+ interval = null ;
55+ }
4356}
4457
4558module . exports . captureSteamData = captureSteamData ;
46- module . exports . captureSocketCount = captureSocketCount ;
59+ module . exports . monitorStart = monitorStart ;
60+ module . exports . monitorStop = monitorStop ;
You can’t perform that action at this time.
0 commit comments