report if state is idle

This commit is contained in:
Josh Harvey 2016-04-21 20:01:27 +03:00
parent 1a93d6ae02
commit 4b5b460d12
2 changed files with 5 additions and 4 deletions

View file

@ -52,7 +52,6 @@ function checkStuckScreen (deviceEvents) {
var sortedEvents = R.sortBy(R.compose(toInt10, R.prop('device_time')), R.map(jsonParse, deviceEvents))
var noRepeatEvents = R.dropRepeatsWith(sameState, sortedEvents)
var lastEvent = R.last(noRepeatEvents)
var IDLE_STATES = ['idle', 'dualIdle']
var STALE_STATE = 60 * 1000
if (!lastEvent) {
@ -60,7 +59,9 @@ function checkStuckScreen (deviceEvents) {
}
var state = lastEvent.note.state
if (R.contains(state, IDLE_STATES)) {
var isIdle = lastEvent.note.isIdle
if (isIdle) {
return []
}

View file

@ -361,7 +361,7 @@ exports.stateChange = function stateChange (session, rec, cb) {
id: rec.uuid,
fingerprint: session.fingerprint,
eventType: 'stateChange',
note: JSON.stringify({state: rec.state, sessionId: session.id}),
note: JSON.stringify({state: rec.state, isIdle: rec.isIdle, sessionId: session.id}),
deviceTime: session.deviceTime
}
db.machineEvent(event, cb)
@ -373,7 +373,7 @@ exports.recordPing = function recordPing (session, rec, cb) {
id: uuid.v4(),
fingerprint: session.fingerprint,
eventType: 'ping',
note: JSON.stringify({state: rec.state, sessionId: session.id}),
note: JSON.stringify({state: rec.state, isIdle: rec.idle === 'true', sessionId: session.id}),
deviceTime: session.deviceTime
}
db.machineEvent(event, cb)