joyent / conch-api

Datacenter build and management service
Mozilla Public License 2.0
22 stars 11 forks source link

"Last seen" should be a field on Relay #869

Closed sungo closed 5 years ago

sungo commented 5 years ago

Looks like right now we're calculating a relay's "last seen" value based on one of the join tables. This value is then only exposed in the context of a workspace.

"Last seen" should be a property of the relay itself, not dependent on a user or workspace connection. This value should be exposed in the return of GET /relay/:id_or_serial_number as well

karenetheridge commented 5 years ago

Sure, I can add a last_seen column to the relay table, and update that whenever we would update user_relay_connection.last_seen and/or device_relay_connection.last_seen. That wouldn't change anything in the GET /workspace/:id/relay response though, as those timestamps are workspace-specific as we are fetching relays whose last known location was in the subject workspace, and both device_relay_connection.last_seen and relay.last_seen will get bumped at the same time.

karenetheridge commented 5 years ago

so, to clarify, I will add a last_seen column to relay, and keep it updated whenever we would bump drc.last_seen and/or urc.last_seen, with all initial values will be set to the greatest of these timestamps. The new column will be included in responses to GET /relay and GET /relay/:id.

Should anything be added to or changed in GET /workspace/:id/relay?

sungo commented 5 years ago

On (08/26 12:40), Karen Etheridge wrote:

Should anything be added to or changed in GET /workspace/:id/relay?

Not at this time.