Add optional deleteSessions, findSessionsByShop#418
Conversation
22cc0cf to
38b960c
Compare
surma
left a comment
There was a problem hiding this comment.
This LGTM.
One question: What is the use-case for findSessionsByShop? Do we need to worry about the returned array being uber large for popular apps?
paulomarg
left a comment
There was a problem hiding this comment.
Looking good, I had some thoughts on how to make a couple of these more efficient, but overall I think this makes sense!
| ): Promise<SessionInterface[] | {[key: string]: unknown}[] | undefined> { | ||
| await this.ready; | ||
|
|
||
| const keys = await this.client.keys('*'); |
There was a problem hiding this comment.
I wonder if it's worth storing the ids for specific shops under a single key, so that we don't have to iterate over every entry to find the ids for a shop. Quite a big change, but I think it's worth it.
There was a problem hiding this comment.
K, that would be better (anything would be better than this current search implementation!) but since it's such a big change to the underlying data structure, I'll leave it for its own PR.
It's "give me the sessions for this one shop", so, with the additional change of using offline sessions, it realistically should be just one entry. |
|
API library component of https://github.com/Shopify/first-party-library-planning/issues/384 |
paulomarg
left a comment
There was a problem hiding this comment.
Aside from a nit about returning the maps directly, LGTM! Haven't tried the mongodb changes myself, though.
To support using the session database as a means to track app installations, adding optional methods to search for sessions by shop and deleting all sessions by a range of ids (e.g., for a shop, or as a garbage collector, if desired).
665c113 to
303a556
Compare
WHY are these changes introduced?
To support using the session database as a means to track app installations, adding optional methods to search for sessions by shop and deleting all sessions by a range of ids (e.g., for a shop, or as a garbage collector, if desired).
WHAT is this pull request doing?
Adding optional
findSessionsByShopanddeleteSessionsinterface methods toSessionStorageand the corresponding implementations in the various DB adapters.Type of change
Checklist