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

通过协程异步执行数据库写入,由于http已返回信息,导致Error: context canceled #4105

Open
sanrentai opened this issue Jan 9, 2025 · 8 comments

Comments

@sanrentai
Copy link
Contributor

通过协程异步执行数据库写入,由于http已返回信息,导致Error: context canceled

使用的是sqlserver 2008 r2 数据库,goframe 版本是 2.8.2

@wwwfeng
Copy link
Contributor

wwwfeng commented Jan 9, 2025

需要new一个ctx,不能用http传入的上下文吧

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


You need a new ctx, you can’t use the context passed in by http.

@sanrentai
Copy link
Contributor Author

需要new一个ctx,不能用http传入的上下文吧

刚升到2.0的时候遇到过这个问题,后来修复过,目前用最新版的又出现了

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


You need a new ctx. You cannot use the context passed in by http.

I encountered this problem when I first upgraded to 2.0, but it was fixed later, and now it appears again with the latest version.

@wln32
Copy link
Member

wln32 commented Jan 9, 2025

需要new一个ctx,不能用http传入的上下文吧

刚升到2.0的时候遇到过这个问题,后来修复过,目前用最新版的又出现了

不要用原来的ctx,或者你可以把你的代码发来看看

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


You need a new ctx. You cannot use the context passed in by http.

I encountered this problem when I first upgraded to 2.0, and it was fixed later. Now it reappears with the latest version.

Don't use the original ctx, or you can send your code for a look

@UncleChair
Copy link
Contributor

文档有写:
https://goframe.org/release/v2.5.0#%E5%85%BC%E5%AE%B9%E6%8F%90%E7%A4%BA

如果不想另起一个context可以直接加 neverDone,这部分文档里也有写:
https://goframe.org/docs/web/faq

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


The document says:
https://goframe.org/release/v2.5.0#%E5%85%BC%E5%AE%B9%E6%8F%90%E7%A4%BA

If you don’t want to start a new context, you can add neverDone directly. This part of the document also says:
https://goframe.org/docs/web/faq

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

5 participants