-
Notifications
You must be signed in to change notification settings - Fork 104
[sql-11] sessions: interface massage #969
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
Changes from all commits
8f5f35b
e923fff
8c4d17c
64f7961
6239428
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -237,8 +237,8 @@ func DeserializeSession(r io.Reader) (*Session, error) { | |||||||||||||||
session.Label = string(label) | ||||||||||||||||
session.State = State(state) | ||||||||||||||||
session.Type = Type(typ) | ||||||||||||||||
session.Expiry = time.Unix(int64(expiry), 0) | ||||||||||||||||
session.CreatedAt = time.Unix(int64(createdAt), 0) | ||||||||||||||||
session.Expiry = time.Unix(int64(expiry), 0).UTC() | ||||||||||||||||
session.CreatedAt = time.Unix(int64(createdAt), 0).UTC() | ||||||||||||||||
Comment on lines
+240
to
+241
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmmm can this somehow lead to some discrepancy between current sessions that were created without UTC, which are now deserialised with UTC? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah def - but i think it's ok. worst case the expiry/created_at times now differ by a couple of hours. I think it's an ok tradeoff and i dont think it is worth the added complexity to make sure we read everything exactly as it was/add a migration etc. thoughts? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. did some testing just to make sure no issues. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So I guess the worst case scenario would be that a user after upgrading has a very recently created session that's now deserialized with a timestamp that's a few hours in the future. Alternatively the same could occur for recently revoked sessions, that's seen as having been revoked in the future. Other than that such scenarios would be pretty confusing (which I think would be fine), there's one edge case where that could lead to a recently created session being automatically revoked: lightning-terminal/session_rpcserver.go Lines 442 to 448 in c0e85e0
But given that it's such an edge case where the worst case scenario would jsut be that a session gets revoked, we deemed this to be an ok tradeoff offline. |
||||||||||||||||
session.ServerAddr = string(serverAddr) | ||||||||||||||||
session.DevServer = devServer == 1 | ||||||||||||||||
session.WithPrivacyMapper = privacy == 1 | ||||||||||||||||
|
@@ -248,7 +248,7 @@ func DeserializeSession(r io.Reader) (*Session, error) { | |||||||||||||||
} | ||||||||||||||||
|
||||||||||||||||
if revokedAt != 0 { | ||||||||||||||||
session.RevokedAt = time.Unix(int64(revokedAt), 0) | ||||||||||||||||
session.RevokedAt = time.Unix(int64(revokedAt), 0).UTC() | ||||||||||||||||
} | ||||||||||||||||
|
||||||||||||||||
if t, ok := parsedTypes[typeMacaroonRecipe]; ok && t == nil { | ||||||||||||||||
|
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.
Can you shed a little bit of light on the benefits of injecting a shared
clock
with the DB? My assumption is it's primarily used to add stability for tests, but not sure if there's more to it than that.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.
yeah it is mainly for deterministic tests so that we can guarantee stable (and incrementing) timestamps