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

I'm getting error ECONNRESET when uploading a lot of users #11

Open
Milanw2 opened this issue May 12, 2017 · 2 comments
Open

I'm getting error ECONNRESET when uploading a lot of users #11

Milanw2 opened this issue May 12, 2017 · 2 comments

Comments

@Milanw2
Copy link

Milanw2 commented May 12, 2017

I have to upload every user one by one because of the thing that if I upload a JSON with existing users in it, it doesn't upload any user. But now I'm getting these errors for every failed uploaded user:

[Unhandled rejection RequestError: Error: read ECONNRESET
    at new RequestError (C:\Users\Milan\Documents\Octopus\Octopus 2.0\node_modules\request-promise\lib\errors.js:11:15)
    at Request.RP$callback [as _callback] (C:\Users\Milan\Documents\Octopus\Octopus 2.0\node_modules\request-promise\lib\rp.js:60:32)
    at self.callback (C:\Users\Milan\Documents\Octopus\Octopus 2.0\node_modules\request\request.js:186:22)
    at emitOne (events.js:96:13)
    at Request.emit (events.js:191:7)
    at Request.onRequestError (C:\Users\Milan\Documents\Octopus\Octopus 2.0\node_modules\request\request.js:845:8)
    at emitOne (events.js:96:13)
    at ClientRequest.emit (events.js:191:7)
    at Socket.socketErrorListener (_http_client.js:358:9)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:191:7)
    at emitErrorNT (net.js:1279:8)
    at _combinedTickCallback (internal/process/next_tick.js:80:11)
    at process._tickCallback (internal/process/next_tick.js:104:9)](url)
@mudrd8mz
Copy link
Owner

It is not clear to me how is this directly related to the moodle client. May it be rather caused by the way how you use it in your app?

@Milanw2
Copy link
Author

Milanw2 commented May 12, 2017

Then please tell me what I'm doing wrong. This is my code:

function send_user_to_moodle(client, username, password, firstname, lastname, email) {
    client.call({
        wsfunction: "core_user_create_users",
        method: "POST",
        args: {
            users: [
                {
                    username: username,
                    password: password,
                    firstname: firstname,
                    lastname: lastname,
                    email: email
                }
            ]
        }
    }).then(function (info) {
        }
    });
};

This code is run over and over again for 50.000 users. This because of the reason explained in the original question.

Thanks for your quick reply!

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