-
Notifications
You must be signed in to change notification settings - Fork 0
Development node last seen #46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
All times in the system should be UTC and never depend on the location of the server, or that the operations are going to configure the server timezone to be UTC. all input times should be UTC, all output times should be UTC, all calculations/comparisons should be using utc times. e.g finding if the node is online
|
definitions: | ||
db.Account: | ||
github_com_threefoldtech_tfgrid4-sdk-go_node-registrar_pkg_db.Account: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did we move to that for resources?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I noticed that, but it's auto-generated and seems unharmful.
I just rerun swag init -g pkg/server/handlers.go --output docs --parseDependency --parseDepth 2
as I always did to update the swagger files since the node model was changed.
Not sure why that location was changed, but I believe that not caused by the changes in this PR? Maybe something related to moving the repo? Any Idea?
Also I see we have last_seen field, but where is up field or online field, that was the request in the tickethttps://github.com//issues/44 no? |
Short answer: Using a “lastSeen” timestamp is a cleaner, more performant approach that minimizes changes to our codebase. It avoids the pitfalls of maintaining and updating a boolean status and empowers clients to define what constitutes an “online” node based on their specific requirements. Long answer: Based on theissue the goal is to provide a way to determine if a node is online based on its reports. Instead of maintaining a separate boolean flag for online/offline status, I opted to store a timestamp field (as “lastSeen”). This design offers several advantages:
However, I can update or revert the changes if they still don’t make sense and adopt any suggested implementation if you find it more suitable. |
Problem is: for convenience of the implementation we pushed the complexity/potential bugs into the clients (we usually have 3: go, ts, and dart) At least provide a filter to query with status=up instead of storing that flag in the database that will does the comparison against the last 40 mins |
Co-authored-by: xmonader <xmonader@gmail.com>
Description
Include the last_seen field in the Node struct, representing the time when the node sent its last uptime report. Clients can use this to determine node availability based on the reporting interval and their chosen allowable window.
Changes
LastSeen
field to the Node structvalidateTimestampHint
helper functionMigrateNodeLastSeen
function that does the following:Related Issues
Checklist