Understanding middleware store calls #9
Closed
callmetwan
started this conversation in
Ideas
Replies: 1 comment 2 replies
-
You're probably right about some things not being perfectly efficient. The reason being, some features got added over time on top of existing code, and I haven't bothered to evaluate the old code after the new code is written. That said, this looks good and if you're willing, make the change and run the tests and make a PR 🙂 You can find instructions at the bottom of the README for running them locally. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi! Thanks for building this library, it's real nifty!
I am vetting it for a project I'm working on and it seems like a good fit. I had a few questions about the inner workings of
Middleware.ts
.https://github.com/jcs224/hono_sessions/blob/main/src/Middleware.ts#L103-L115
The conditional check to rotate the session key makes sense to me. What I'm struggling with is the next line immediately calls
persistSessionData
.As it stands the session is created and then it is immediately updated, seemingly resulting in an unnecessary roundtrip to the data store. Is there
Next there is a check for deletion. Why do this at the end rather than start with that check and skip session rotation/persistence?
My thoughts as code:
Thanks for letting me muse!
Beta Was this translation helpful? Give feedback.
All reactions