Comments (3)
Also if you have any suggestions on where to start in a pull request for this let me know as I'd love to contribute back.
I started working here to dispatch_sync back to main queue there, but this breaks the unit tests as they execute this method directly on the main thread and thus dispatching sync would cause deadlock.
Also dispatch_async to main queue here breaks unit tests as it can't verify that that handler is invoked after data updates are flushed. See this test;
This was just a test attempt to see if I could make a quick fix. Ideally the queue on which to execute the block should be configurable, or default to the queue that called the method.
from meteor-ios.
Same goes for global NSNotifications that are exposed in METDDPClient
from meteor-ios.
I completely agree. In most cases, being called back on the main queue is what you want so this should be the default to avoid a common source of bugs. Ideally, the queue would indeed be configurable. As far as I know, there is no reliable way to default to the queue that called a method (dispatch_get_current_queue
is deprecated). We could add a queue: argument to all methods that take a callback block and that defaults to the main queue (but that wouldn't work for notifications) or specify this at a more global level. A callbackQueue
property on METDDPClient
is probably sufficient for most uses (other name suggestions welcome).
I'd have to look more into this to be sure, but maybeInvokeCompletionHandler
seems like the right place to dispatch to a different queue. That might require changes to the unit tests. In other places, I use XCTestExpectation
/waitForExpectationsWithTimeout:
to test async code. Here the issue seems to be that I wanted to test that the callback isn't invoked when only one of didReceiveResult:error
and didFlushUpdates:
is called. But I don't like the dependency on synchronous invocation and would prefer to find another way to test this.
If you have any ideas about this, please try them out and let me know or make a pull request. I probably won't have time to work on this myself before next week.
from meteor-ios.
Related Issues (20)
- When using local IP of my macbook where meteor is running not able to connect to iPhone (ws://local IP:4000/websocket) HOT 1
- managedObjectContext nil - NSFetchedResultsController
- How to refactor METAccount so we can pass in our own service and access group to keychain?
- [IOS][1.3+] WKWebView terminated [White Screen of Death] - kills Geofence events HOT 5
- Not able to get the document ID from the collection. HOT 3
- hello @import Meteor;
- You this is written in Swift, please HOT 1
- preform complex fetches via METFetchRequest to METDatabase#executeFetchRequest:
- Mobile-config.js - App.info: Team HOT 1
- Application crash after assertionFailure in sendMessage Meteor/METDDPConnection.m:74 HOT 1
- How to listen subscription with METDDPClient HOT 1
- retry opening connection
- How to to get notified for specific collection changes?
- How to correctly use updateDocumentWithID? HOT 2
- Support meteor 1.5?
- How to log Out in Swift?
- Custom Mapping to Coredata
- Is this still being maintained? HOT 1
- How to listen to the subscriptions?
- Library not loaded: @rpath/InflectorKit.framework/InflectorKit
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from meteor-ios.