-
Notifications
You must be signed in to change notification settings - Fork 57
How to handle active clients during re-deploys? #10
Comments
I think the right approach is to keep around all queries that have ever been persisted, until you are really sure there are no old clients out there. So I would suggest taking the output of this tool and adding some large number to every ID. Perhaps a PR to switch to UUIDs instead of numbers would be good, then people can just insert the IDs as-is. |
I think keeping them in a database would be reasonable. Are you planning on supporting a feature like this in Ruby? |
Agree with @stubailo. I think persistgraphql should probably allow you to do a "merge with existing" kind of thing where you can crawl an updated codebase but merge it with an existing persisted queries JSON file. |
Is that to avoid saving duplicate queries? Actually, using a hash instead of an ID would probably solve that since you can just insert into your database of queries if the hash doesn't exist. |
In my mind, it would just be a convenience thing that allows you to handle multiple client versions rather than something that's meant to reduce the number of queries represented in the map. |
I guess I don't think anyone will actually be storing the queries in a JSON file, so if anything a more useful thing would be a function that saves the queries to some kind of storage. |
Yeah, I'm definitely interested in building a persisted query system for Ruby servers. I took a crack at it a while back and it left me with these questions:
So, I didn't come up with any answers ... just questions 😆 thanks for sharing your thoughts! |
Oh, I think the server should accept all queries in development mode. So the answers to your questions IMO are:
Let me know if I can help with a Ruby server addition! |
Hi, thanks for sharing this repo! Looks like lots of good work.
I've been doing some thinking about persisted queries as well (but not much doing). I'm curious how you'd handle this situation:
For example, let's say you start with a
.graphql
file likeAnd you run
persistgraphql
which generates a query map:Then, later, you refactor the query:
And again,
persistgraphql
to get a map:But now, ID
1
points at a new query, which may cause some clients to break! How should we avoid that?The only thing I can think of is: never change or remove a persisted query until you're sure no outstanding clients depend on it. Instead of changing queries, always add new ones. Do we have any other tools to help in this case?
The text was updated successfully, but these errors were encountered: