Skip to content
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

Question: Respond before commit transaction #385

Closed
suppakorn-dev opened this issue May 2, 2024 · 3 comments
Closed

Question: Respond before commit transaction #385

suppakorn-dev opened this issue May 2, 2024 · 3 comments

Comments

@suppakorn-dev
Copy link

Following the handler code, you respond before committing the transaction in the middleware. What would happen if the tx.Commit() call returns an error?

@suppakorn-dev suppakorn-dev changed the title Respond before commit transaction Question: Respond before commit transaction May 2, 2024
@ardan-bkennedy
Copy link
Contributor

Hmmmm. Right the handler will send the OK response, and then the middleware will unwind. There is a chance the Commit fails. In that case, the error middleware would log the error, the call to send a second response would happen, before closing the connection. Until we actually try it, I'm not 100% sure. I am going to try this now.

@ardan-bkennedy
Copy link
Contributor

@suppakorn-dev you opened a can of worms. hahahahaha

I have made changes to support the middleware rolling back and responding properly. It required changes to the web package and protocol layer code. The code is better for it.

Thanks!

@PH9
Copy link

PH9 commented May 3, 2024

Fixed with #387 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants