Permalink
Browse files

Cluster is no longer used when debugging with --debug

  • Loading branch information...
1 parent c5b1cd1 commit 1096c9daca9feffaa46c3f1f4a6b55d658e18ad7 @mikefrey mikefrey committed Nov 5, 2012
Showing with 11 additions and 7 deletions.
  1. +3 −1 app.js
  2. +7 −6 master.js
  3. +1 −0 worker.js
View
4 app.js
@@ -85,7 +85,9 @@ _.extend(App.prototype, {
domain.on('error', function(err) {
try {
//res.error(500, err)
- res.end(500)
+ res.statusCode = 500
+ console.log(err)
+ res.end('An error occurred.')
}
finally {
domain.dispose()
View
@@ -4,17 +4,18 @@ module.exports.start = function(config) {
var workerScript = './worker.js'
- // debug mode, don't run the cluster, just execute the worker
- if (~process.argv.indexOf('--debug') || ~process.argv.indexOf('--debug-brk')) {
- process.argv.append('--worker=' + config.worker)
- return require(workerScript)
- }
-
// init logger
var logger = require('bunyan').createLogger(config.log || { name:'Nokomis App Master'})
console.error = logger.info.bind(logger)
console.log = logger.info.bind(logger)
+ // debug mode, don't run the cluster, just execute the worker
+ var argv = process.argv.concat(process.execArgv || [])
+ if (~argv.indexOf('--debug') || ~argv.indexOf('--debug-brk')) {
+ process.argv.push('--worker=' + config.worker, '--config=' + config.config)
+ return require(workerScript)
+ }
+
// configure the cluster
var clusterMaster = require("cluster-master")
var clusterConfig = config.server.cluster || { size:1 }
View
@@ -35,3 +35,4 @@ if (!App) {
// initialize the App
var app = new App(config)
+module.exports = app

0 comments on commit 1096c9d

Please sign in to comment.