Replies: 1 comment 10 replies
-
|
Hello @rcarver, Your issue is that you can't access task locals from within asynchronous database access methods. Thanks for the report! It would be nice to support this indeed.
They take an This issue thus boils down to allowing closures run by A quick Google search does not yield any immediate solution. And it is not quite easy to understand how to do it, or even if it is possible, when I read the Task-locals in contexts where no Task is available specification. Until more research is performed, could you please share more information about your specific use of task locals? Maybe we can find an acceptable workaround. This topic could interest other GRDB users as well. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello! Wanted to start a discussion about the async forms of read and write. These functions take an
@escapingclosure, which causes problems with structured concurrency tooling, specificallyTaskLocalWould it be possible to change these functions to not take an
@escapingclosure?Issues with Swift Testing
Below is an demo of two key problems:
TaskLocalvariables lose their scoped value#expectfails, it causes an additional error reported byTestingOther known incompatibilities
It's not only a
Testingproblem though, theTaskLocalissue could easily cause unexpected behavior in many application contexts.TaskLocalfor the test configuration, so fails in confusing ways when used to test queries in an async context.assertQueryhelper which does just that. If the test case must be async, these tools fail to behave correctlyTaskLocalunexpected behavior could easily occur.Tagging @stephencelis @mbrandonw for any additional insights or gotchas they might be aware of.
Thanks for considering!
Beta Was this translation helpful? Give feedback.
All reactions