-
Notifications
You must be signed in to change notification settings - Fork 107
add is memory token property to sessions #2004
add is memory token property to sessions #2004
Conversation
scripts/test-local.sh
Outdated
@@ -4,7 +4,7 @@ set -eu | |||
|
|||
glob=$* | |||
if [ -z "$glob" ]; then | |||
glob="--recursive test/local test/remote" | |||
glob="--recursive test/remote/db_tests.js" |
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.
@udaraweerasinghege Do you need to undo this change?
@@ -526,7 +526,8 @@ module.exports = ( | |||
uaOSVersion: token.uaOSVersion, | |||
uaDeviceType: token.uaDeviceType, | |||
lastAccessTime: token.lastAccessTime, | |||
createdAt: token.createdAt | |||
createdAt: token.createdAt, | |||
isMemoryToken: true |
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.
@udaraweerasinghege we also need to update the response schemas for /sessions and /devices, to handle this optional property. I'm hoping API.md will auto update with this
32a0827
to
24ee4eb
Compare
@@ -1202,6 +1208,12 @@ for the authenticated user. | |||
|
|||
<!--end-response-body-get-accountsessions-isCurrentDevice--> | |||
|
|||
* `isMemoryToken`: *boolean, required* |
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.
With appologies for the late drive-by comment, this seems like it's piercing a layer of abstraction - it's taking an internal implementation detail of the server and exposing it in the API for consumption by the client. To display the correct information, the content-server needs to know that the auth-server sometimes stores tokens in redis, and that these tokens are the only ones that are up-to-date.
I wonder if a better abstraction here would involve us sending two separate timestamps:
lastAccessTime
: the value from redis, but it might benull
if we don't have a correct value to showcreatedTime
: the "started syncing" timestamp which we know we can always get from the db
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.
I wonder if a better abstraction here would involve us sending two separate timestamps
Yeah we had that idea earlier, but I Think @philbooth wanted to keep the fields from redis and mysql consistent (to avoid confusion, etc)
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.
from mtg:
lastAccessTimeFormatted
- redis token
createdTimeFormatted
- created token
Fwiw, I just checked with @philbooth and he's +1 to @rfk's suggestion. 😄 The consistency comment concerned whether session tokens returned from redis should also include data that was fetched from MySQL, IIRC. I see no conflict here. |
#2002