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
@escaping
closure, which causes problems with structured concurrency tooling, specificallyTaskLocal
Would it be possible to change these functions to not take an
@escaping
closure?Issues with Swift Testing
Below is an demo of two key problems:
TaskLocal
variables lose their scoped value#expect
fails, it causes an additional error reported byTesting
Other known incompatibilities
It's not only a
Testing
problem though, theTaskLocal
issue could easily cause unexpected behavior in many application contexts.TaskLocal
for the test configuration, so fails in confusing ways when used to test queries in an async context.assertQuery
helper which does just that. If the test case must be async, these tools fail to behave correctlyTaskLocal
unexpected 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