appsquickly/TyphoonRestClient

Data serialization done on main queue

SandeepAggarwal opened this issue · 3 comments

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?

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;

@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?

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.