-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Retry-After hint when in recovery mode #1878
Comments
Hello, I'm completely new to Haskell. So, I want to make sure I'm moving in the right direction to make a PR for this issue. Am I right in the following:
In this PR we should look at the line in So, I have to:
|
Im thinking I can add something in the Basically I'm saying, Ill make a state in |
Your intuition is exactly right! 💯 The issue here is that the AppState is not modeled very well, making this much more difficult than it should be. Currently we track separate values for data AppStateConnection
= NotConnected
| Connecting { retryDelay :: Int }
| ConnectionSucceeded PgVersion
| ... With this in place, it would be pretty straight forward to set the header. It's a pretty fundamental refactor, however, and it will be tricky to not change the behavior. If you'd like to dive into this together, very happy to! Fully understand if you don't, though - In that case, I'd take a stab at remodeling the state and you could take care of the header afterwards! |
Yes I'd like to make a PR for this. However, I was trying to modify the
And I was going to just set this in |
Go for it! We’ll sort the rest out later :-) |
I'm sure I will find time to review... :D |
Yay, welcome back! 🥳 |
@gautam1168 if you want to discuss anything or need help, let us know! Highly recommend the Nix development environment by the way, see https://github.com/PostgREST/postgrest/blob/main/nix/README.md Otherwise Stack is also fine, but the environment in nix-shell is next level 👌 |
I have setup nix on my system and got the unit tests running. Ill try to make a PR today, but Im new to haskell so it might take me a few days to actually get my changes to compile 😛. Ill keep you guys posted. |
I have gotten the code to compile 😄. Although I have not actually run them yet. But I see that pull requests have to come from forks and I just made my changes in the clone. Ill transfer my changes to a fork, run some tests and open a PR, maybe tomorrow. |
@steve-chavez Hey so I have opened the PR and I have tested that
@monacoremo Also let me know if you want me to squash my commits. |
@steve-chavez how do I go about getting this PR reviewed/merged? |
@gautam1168 Check the comments I've left you on #1916.
Btw, that job didn't fail on our CI. Looks ok. |
If PostgREST loses the postgresql connection, it retries it with exponential backoff. If it's retrying the connection after 32 seconds, it wouldn't make sense for the client to retry a request in 1 or 2 seconds.
Retry-After would be a nice hint for this case, clients can use its value for how much should they wait before retrying.
The text was updated successfully, but these errors were encountered: