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

Add ExecuteParallel for making requests in parallel #67

Open
jbkly opened this issue Oct 9, 2014 · 4 comments
Open

Add ExecuteParallel for making requests in parallel #67

jbkly opened this issue Oct 9, 2014 · 4 comments

Comments

@jbkly
Copy link

jbkly commented Oct 9, 2014

Is there any support for passing in an array of urls to GetJSON so you can get multiple resources with one get request?

@timhall
Copy link
Member

timhall commented Oct 9, 2014

@jbkly this is not currently implemented, but I've definitely thought about it. It would require some low-level changes to make it synchronous for GetJSON, but I'll see if I can include it / lay the groundwork for it in the work I'm doing for v4.0

@timhall timhall added this to the 4.0 milestone Oct 20, 2014
@timhall timhall removed this from the 4.0 milestone Dec 18, 2014
@timhall
Copy link
Member

timhall commented Dec 18, 2014

I'm pushing this until after the v4.0.0 release. As far as I can tell, this should be feasible in both Windows and Mac, but it'll be a little bit of an undertaking. I'll use this issue for notes and design.

Initially design as a wrapper (like AsyncWrapper) for use like the following:

' WebParallelWrapper.cls
' @param {Array|Collection|Dictionary} Requests
Public Function ExecuteParallel(Requests As Variant) As Variant
    ' If Requests is Array return Array of WebResponse
    '                Collection -> Collection
    '                Dictionary -> Dictionary

    ' Dictionary is useful for named requests,
    ' but Array/Collection is probably most common use case
End Function

' YourModule.bas
Dim Client As New WebClient
' Setup Client...

Dim Wrapper As New WebParallelWrapper
Set Wrapper.Client = Client

Dim Requests() As WebRequest
' Or Requests As New Collection
' Or Requests As New Dictionary
' Setup and add requests...

Responses = Wrapper.ExecuteParallel(Requests)
' -> Responses = Array of WebResponse

Notes:

@timhall timhall changed the title multiple resources in one GetJSON request? Add ExecuteParallel for making multiple requests in parallel Dec 18, 2014
@timhall timhall changed the title Add ExecuteParallel for making multiple requests in parallel Add ExecuteParallel for making requests in parallel Dec 18, 2014
@gerald2545
Copy link

Hi Tim,
is this enhancement implemented? I'm really interested

Thank you

Gerald

@Sophist-UK
Copy link
Contributor

See #206 for a better Async capability which allows requests in parallel. So you can already send them in one by one and process the requests via a call-back when they complete.

However this is Windows only - not being a Mac user I haven't been able to look at doing cUrl calls in parallel.

The ability to do multiple requests in parallel from one synchronous call would require a wrapper to make the requests and wait for all of them to complete before returning to the caller.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants