Cloudflare recently released global read replication for D1 (🎊 ) but it requires tagging all queries within a session to assure read-after-write consistency.
https://developers.cloudflare.com/d1/best-practices/read-replication/#replica-lag-and-consistency-model
I don't think a similar concept exists in Kysely, but we could potentially add a new session? argument to the constructor, and if used, .executeQuery would run against the const session = env.DB.withSession(...) instead of env.DB.
I think we might need to also expose some way of returning session.getBookmark(), and then users would need to:
- Make sure to re-initialize on every request and not share a global singleton/etc.
- Handle storing the resulting bookmark in an HTTP header and reading from it before initializing in their own code
Cloudflare recently released global read replication for D1 (🎊 ) but it requires tagging all queries within a session to assure read-after-write consistency.
https://developers.cloudflare.com/d1/best-practices/read-replication/#replica-lag-and-consistency-model
I don't think a similar concept exists in Kysely, but we could potentially add a new
session?argument to the constructor, and if used,.executeQuerywould run against theconst session = env.DB.withSession(...)instead ofenv.DB.I think we might need to also expose some way of returning
session.getBookmark(), and then users would need to: