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

Concurrency issues? #4

Closed
bradvogel opened this issue Mar 16, 2015 · 4 comments
Closed

Concurrency issues? #4

bradvogel opened this issue Mar 16, 2015 · 4 comments

Comments

@bradvogel
Copy link
Collaborator

I'm running a HTTP server that accepts user requests. So I'm trying to use multiple instances of Batchelor to service different users. However, the API is entirely singleton, so calling Batchelor.init() with a different user will overwrite the previous call.

What's your recommended way to create two instances of Batchelor at the same time?

@bradvogel
Copy link
Collaborator Author

I fixed this locally here: https://github.com/mixmaxhq/batchelor/pull/1/files?w=1, but it's a breaking API change. Let me know if you'd like me to submit a PR for that (although it'll require readme changes also).

The new API would be:

var batchelor = new Batchelor({
    'uri':'https://www.googleapis.com/batch',
    'method':'POST',
    'auth': {
        'bearer': [... Google API Token ...]
    },
    'headers': {
        'Content-Type': 'multipart/mixed;'
    }
});

batchelor.add()...

@jamesmhaley
Copy link
Contributor

@bradvogel Have invite you to contribute. Feel free to add a new branch for version 1 and include your changes in that. We'll make that a major release feature.

@bradvogel
Copy link
Collaborator Author

Thanks. Pushed a branch. Diff here: https://github.com/wapisasa/batchelor/compare/v1?expand=1&w=1

@jamesmhaley
Copy link
Contributor

Cheers Bud.

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

No branches or pull requests

2 participants