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

Data serialization done on main queue #18

Open
SandeepAggarwal opened this issue Jun 12, 2017 · 3 comments
Open

Data serialization done on main queue #18

SandeepAggarwal opened this issue Jun 12, 2017 · 3 comments

Comments

@SandeepAggarwal
Copy link

SandeepAggarwal commented Jun 12, 2017

The Serialization is being done on main queue instead of background queue which is causing the app to become unresponsive in case of large amount of data in request/response.
Is there anyway we can offload the serialization to background?

@alexgarbarev
Copy link
Contributor

Hey @SandeepAggarwal. Yes, serialization and validation is done on main queue by default, but you can change it by:

TyphoonRestClient *restClient = [TyphoonRestClient new];

NSOperationQueue *backgroundQueue = [NSOperationQueue new];
//Configure your background queue here


restClient.workQueue = backgroundQueue;

@SandeepAggarwal
Copy link
Author

SandeepAggarwal commented Jun 12, 2017

@alexgarbarev Thank you for your reply. Is there any specific reason for not doing it in background by default? Shouldn't it be done in bg always?

@alexgarbarev
Copy link
Contributor

Hey @SandeepAggarwal. The reason of that was serialisation and mapping into database objects such a "Realm" or "CoreData". It requires special treatment, and doing all on main thread avoids crashes.

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

2 participants