Suppose I have the following
Server data model:
Server -> created_at Timestamp -> last_ping Timestamp
Server is defined as a
last_ping occurred more than one hour ago (i.e.,
last_ping < Time.now - 1 hour). It should be destroyed if there exists another non-stale server that has come online (
created_at) within one hour of the
last_ping of the stale server.
How can I find all the
Servers that should be destroyed? What would a query look like for this?