Optimize machine pings query (#222)
* refactor recordPing method * optimize queries * migrate machine_pings remove id, serial_number add primary key on device_id add unique constraint on device_id * remove filelds from query, rename migration, delete duplicate migration * truncate machine_pings in migration
This commit is contained in:
parent
e7bb29341d
commit
13040f41a1
3 changed files with 22 additions and 12 deletions
|
|
@ -130,9 +130,7 @@ function checkStuckScreen (deviceEvents) {
|
|||
|
||||
function checkPing (deviceId) {
|
||||
const sql = `select (EXTRACT(EPOCH FROM (now() - created))) * 1000 AS age from machine_pings
|
||||
where device_id=$1
|
||||
order by created desc
|
||||
limit 1`
|
||||
where device_id=$1`
|
||||
|
||||
return db.oneOrNone(sql, [deviceId])
|
||||
.then(row => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue