Skip to content
Browse files

0.1.1 recovery now continuous, log uses getISOPacific

  • Loading branch information...
1 parent be9ec49 commit 486ccb28bc09c06e9d91eee8e84d8fb884789635 @haraldrudell committed Dec 22, 2012
Showing with 16 additions and 9 deletions.
  1. +8 −2 lib/appentity.js
  2. +1 −1 lib/godmodel.js
  3. +1 −1 lib/master/establish.js
  4. +0 −1 lib/masterlink.js
  5. +1 −1 lib/watchit.js
  6. +1 −0 nodegod.json
  7. +1 −1 package.json
  8. +3 −2 webprocess.js
View
10 lib/appentity.js
@@ -5,6 +5,8 @@ var requesturl = require('apprunner').getApi({api: 'requesturl'})
var watchit = require('./watchit')
var watchcopy = require('./watchcopy')
var appstate = require('./appstate')
+// https://github.com/haraldrudell/haraldutil
+var haraldutil = require('haraldutil')
// http://nodejs.org/api/path.html
var path = require('path')
@@ -167,7 +169,7 @@ function AppEntity(conf) {
// crash recovery
var doRecovery = !previousCrash
if (!doRecovery) {
- var elapsed = Math.floor((previousCrash - lastCrash) / 1000)
+ var elapsed = Math.floor((lastCrash - previousCrash) / 1000)
doRecovery = elapsed >= minSecondsCrashToCrash
}
if (doRecovery) appState.recover()
@@ -212,7 +214,11 @@ function AppEntity(conf) {
function logDifference(state) {
var s = ['Update', state.name + ':']
- for (var p in state) if (state[p] != lastState[p]) s.push(p + ':', state[p])
+ for (var p in state) if (state[p] != lastState[p]) {
+ var v = state[p]
+ if (p == 'lastCrash' || p == 'lastLaunch') v = haraldutil.getISOPacific(new Date(v))
+ s.push(p + ':', v)
+ }
console.log(s.join(' '))
return lastState = state
}
View
2 lib/godmodel.js
@@ -71,7 +71,7 @@ function loadAppFiles(defaults) {
// watchFiles
function processAppFile(filename) {
console.log('Processing:', filename)
-console.log(arguments.callee.name, filename)
+//console.log(arguments.callee.name, filename)
var fileObject = haraldops.loadSettings(filename)
for (var appName in fileObject) {
View
2 lib/master/establish.js
@@ -42,7 +42,7 @@ function establish(marker, theSignal, cb) {
}
function writeResult(err) {
- if (err) console.log('writing pid:', err.toString)
+ if (err) console.log('writing pid:', err.toString())
cb(true) // we're master exit
}
}
View
1 lib/masterlink.js
@@ -1,7 +1,6 @@
// masterlink.js
// ipc link to master process
// © Harald Rudell 2012
-console.log(process.pid, process.send)
exports.getMaster = getMaster
var emitter = new (require('events').EventEmitter)
View
2 lib/watchit.js
@@ -26,7 +26,7 @@ function WatchIt(restartFunc, notifyFunc) {
// return value: number of files being watched
this.updateFiles = function(fileValue, folder) {
-console.log(fileId, arguments.callee.name, fileValue, folder)
+//console.log(fileId, arguments.callee.name, fileValue, folder)
var newFiles = []
if (fileValue) newFiles = getfilenames.getFileArray(fileValue, folder, 'js')
if (!areStringArraysSame(files, newFiles)) {
View
1 nodegod.json
@@ -0,0 +1 @@
+{}
View
2 package.json
@@ -8,7 +8,7 @@
"node",
"operations"
],
- "version": "0.1.0",
+ "version": "0.1.1",
"contributors": [
{
"name": "Harald Rudell",
View
5 webprocess.js
@@ -67,8 +67,9 @@ function initAppResult(err) {
}
app.listen(defaults.PORT, defaults.appInterface)
//app.listen(defaults.worldPort)
-console.log('Application %s on node %s available on port %s in %s mode',
+console.log('Application %s on port %s node %s express %s %s mode',
defaults.init.appName,
- process.version,
defaults.PORT,
+ process.version,
+ express.version,
app.settings.env)

0 comments on commit 486ccb2

Please sign in to comment.
Something went wrong with that request. Please try again.