-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Main Thread blocked using FMDatabaseQueue #334
Comments
Can you do a "bt all" in your debugger when the stall happens, and paste that here? |
wow that was insanely fast haha. thanks for the quick response. The stall is very brie, but it's noticeable when I don't download my data versus when I do use it. About 1.5 seconds of delay on the UI. I'm not sure if this is correct but i used 'bt all' from a breakpoint on one of the first db calls: sorry, i shouldn't paste that here. here's the paste bin: http://pastebin.com/raw.php?i=fJtCfV9t |
Oh- so it's not a deadlock, just a pause. I would move your inDatabase: outside of the for loop, and use inTransaction: instead. So it's like:
|
A couple of issues:
|
@ccgus and @robertmryan thank you so much for the quick and detailed responses. I definitely see noticeable improvements using the suggestions provided. I really appreciate it 👍 |
Hi, I have a method being called as follows:
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
[[self dataAccess] downloadCustomers];
});
...
and the method does the following.
FMDatabaseQueue *queue = [FMDatabaseQueue databaseQueueWithPath:[self dbPath]];
However, it seems to be blocking my UI/main thread although I'm trying to use dispatch_async and following this wiki's instructions on using the FMDatabaseQueue instead of opening a new DB on every call. Is there something I'm missing? Thanks!
The text was updated successfully, but these errors were encountered: