You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by Tony Wang <wa...@gmail.com> on 2018/11/10 01:06:34 UTC

[Discussion]Replace dispatch queue with nsoperation queue in CDVCommandDelegateImpl.m

Dear Cordova developers and maintainers,

This is ECNU3D from GitHub. I want to propose a potential improvement for
the CDVCommandDelegateImpl.m. I filed a Github issue here:
https://github.com/apache/cordova-ios/issues/452

My primary concern is that currently Cordova doesn't have any control about
the concurrency of a plugin api call as we're using global dispatch queue
directly(application may easily reach the GCD global thread limitation if
developer abused async function like promise).

I think as iOS has already provided the more advanced NSOperationQueue
utility, why not we consider to replace the dispatch queue with it? Have a
limitation and control on number of concurrency of plugin calls from the
Cordova side will bring a lot of benefits and make the app more stable even
the app developer abused the plugin api call(call it with promise.all for
1000 times.).

I also created a PR to demonstrate this idea:
https://github.com/apache/cordova-ios/pull/454

I'm just a newbie of Cordova development, and input or feedback is largely
welcomed.

BR,
ECNU3D

Re: [Discussion]Replace dispatch queue with nsoperation queue in CDVCommandDelegateImpl.m

Posted by Jesse <pu...@gmail.com>.
Hi Tony,

I just dug this email out of the 'moderate' list.  I have replied to your
pr directly on github, lets continue the discussion there.

Cheers,
  Jesse

@purplecabbage


On Mon, Nov 12, 2018 at 2:28 AM Tony Wang <wa...@gmail.com> wrote:

> Dear Cordova developers and maintainers,
>
> This is ECNU3D from GitHub. I want to propose a potential improvement for
> the CDVCommandDelegateImpl.m. I filed a Github issue here:
> https://github.com/apache/cordova-ios/issues/452
>
> My primary concern is that currently Cordova doesn't have any control about
> the concurrency of a plugin api call as we're using global dispatch queue
> directly(application may easily reach the GCD global thread limitation if
> developer abused async function like promise).
>
> I think as iOS has already provided the more advanced NSOperationQueue
> utility, why not we consider to replace the dispatch queue with it? Have a
> limitation and control on number of concurrency of plugin calls from the
> Cordova side will bring a lot of benefits and make the app more stable even
> the app developer abused the plugin api call(call it with promise.all for
> 1000 times.).
>
> I also created a PR to demonstrate this idea:
> https://github.com/apache/cordova-ios/pull/454
>
> I'm just a newbie of Cordova development, and input or feedback is largely
> welcomed.
>
> BR,
> ECNU3D
>