Closed BNNorman closed 3 years ago
Hrm, that's odd. We're pulling the last seen from the last seen column, which is updated by dbLoader I think. It's likely to be a database loading issue rather than an issue with the web interface I'd suspect.
How is it converted to human readable form? If it was database loading it should change when the popup is closed and reopened, i think.
That's odd. On my tablet Freetown way showed as "3 weeks ago" so I came upstairs to my PC and it correctly shows 1 hour ago. Also, the last_seen in the database is correct.
Whatever, that sensor should not have shown as last seen 3 weeks ago when it was updated hourly - it could only be 1 hour wrong.
Oddly, it still shows as 3 weeks ago on my android tablet even after pressing the page refresh. Dunno if you can see that in logs anywhere?
Ok, cleared the cache on my tablet and the problem went away - why is it cached?
It's converted to human-readable form by this code: https://github.com/ConnectedHumber/Air-Quality-Web/blob/master/client_src/js/Helpers/DateHelper.mjs
Basically it takes the difference between now and the last seen time, turns that into something human-readable, and then appends ago
to it.
Hrm, that's really strange. last_seen
is reported by the list-devices
action. In production caching of this action should be controlled by this code, which sets the cache header to 30 seconds by default.
Strangely it started again. Where does that code run? Browser?
Ill look later
This code runs on the server and sends a cache-control
header. It seems as if it's your device caching when it really shouldn't be. Hrm.
One of my sensors shows as last seen 3 weeks ago but the chart shows readings from today.
Other sensors show similar though one says 1 week ago with apparently current values.