fix date bug
This commit is contained in:
parent
fefeedb086
commit
1a93d6ae02
4 changed files with 17 additions and 4 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -6,6 +6,7 @@ lib-cov
|
|||
*.out
|
||||
*.pid
|
||||
*.gz
|
||||
*.pem
|
||||
|
||||
pids
|
||||
logs
|
||||
|
|
|
|||
|
|
@ -35,9 +35,12 @@ function checkPing (deviceEvents) {
|
|||
var NETWORK_DOWN_TIME = 2 * 60 * 1000
|
||||
|
||||
if (!lastEvent) {
|
||||
return []
|
||||
return [{code: 'ping'}]
|
||||
}
|
||||
|
||||
console.log('DEBUG6')
|
||||
console.log(lastEvent)
|
||||
|
||||
if (lastEvent.age > NETWORK_DOWN_TIME) {
|
||||
return [{code: 'ping'}]
|
||||
}
|
||||
|
|
@ -100,8 +103,11 @@ function checkStatus (cb) {
|
|||
})
|
||||
|
||||
console.log('DEVICE: ' + deviceRow.fingerprint)
|
||||
alerts = R.concat(alerts, checkStuckScreen(deviceRow, deviceEvents))
|
||||
alerts = R.concat(alerts, checkPing(deviceRow, deviceEvents))
|
||||
alerts = R.concat(alerts, checkStuckScreen(deviceEvents))
|
||||
alerts = R.concat(alerts, checkPing(deviceEvents))
|
||||
|
||||
console.log(deviceFingerprint)
|
||||
console.log(alerts)
|
||||
|
||||
// TODO: Use promises to do this right
|
||||
})
|
||||
|
|
|
|||
|
|
@ -368,6 +368,7 @@ exports.stateChange = function stateChange (session, rec, cb) {
|
|||
}
|
||||
|
||||
exports.recordPing = function recordPing (session, rec, cb) {
|
||||
console.log('DEBUG4')
|
||||
var event = {
|
||||
id: uuid.v4(),
|
||||
fingerprint: session.fingerprint,
|
||||
|
|
|
|||
|
|
@ -167,6 +167,7 @@ function dispenseAck (req, res) {
|
|||
}
|
||||
|
||||
function deviceEvent (req, res) {
|
||||
console.log('DEBUG5')
|
||||
plugins.logEvent(session(req), req.body)
|
||||
res.json({err: null})
|
||||
}
|
||||
|
|
@ -271,7 +272,11 @@ function init (localConfig) {
|
|||
}
|
||||
|
||||
function session (req) {
|
||||
return {fingerprint: getFingerprint(req), id: req.get('session-id')}
|
||||
return {
|
||||
fingerprint: getFingerprint(req),
|
||||
id: req.get('session-id'),
|
||||
deviceTime: Date.parse(req.get('date'))
|
||||
}
|
||||
}
|
||||
|
||||
function getFingerprint (req) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue