Proposal to fix issues with async method stubs

Meteor.defer() has a different use case with async.

Meteor.defer() is for code executions that you don’t have to wait for to complete, so like a promise that you don’t wait to resolve.

async code is something you have to await, so a promise you wait to resolve

Fantastic point. Never thought of these functions if you have not enumerated them.

Hi Guys & @zodern , @grubba :slight_smile:

We’re using @zodern 's package, zodern:fix-async-stubs@1.0.2 in our app now, and we’re gonna do final testing soon, but the good news is that

a) it doesn’t seem to impact anything method-wise negatively which isn’t related to async stubs in the client, so we could just add it & our app keeps on working, tests are working too
b) we’ve selectively re-added the client side stubs to slightly longer running methods which would profit from a lil’ client side simulation speed boost, and so far we had no issues!

We’re still doing more QA testing, but I expect we’ll put it in production next week, including the new package…

We started with @zodern 's package as he got here first :slight_smile:

4 Likes

Hi y’all & @zodern, @grubba :slight_smile:

Quick update on using @zodern’s package, zodern:fix-async-stubs@1.0.2:

As mentioned by @DanielDornhardt, we integrated the package, and initially, things seemed promising. However, during our testing phase, we encountered an issue specifically with Cordova (mostly tested on Android). The client-side stubs worked fine, but it appears to impact the method calls. It always worked seamlessly for the first method call, but subsequent calls (for the same method) never seemed to reach the server.

For now, we reverted the changes and removed the package, and everything returned to normal. The server received the subsequent method calls as expected.

We just wanted to inform you, in case others had similar issues. If you want to investigate this matter and need more information, feel free to reach out.

Thanks for your continued support!

Did you try this with the beta-0? Could you try it? But don’t forget to remove this package from your app. beta-0 has this code in its core. We also made some adjustments to cover some edge cases, so maybe it’ll work for you. If not, let us know.

Hi @dennisdarko and @denyhs

I’m not using “zodern:fix-async-stubs” but I’m facing a similar problem:

After calling an async method (with callAsync) that was declared both on server and client (with Meteor.methods()), all the sync methods seem to stop reaching the server.

If I run Meteor.methods only in the server (inside if (Meteor.isServer)), I don’t have this issue.

This only happens in the Android app (Cordova), the web version works fine both on desktop and mobile.

I created an issue on Github with an example: