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

Rocky.Context.sendToAll sends a response not to all open requests #21

Open
dbukhmastov opened this issue Jul 26, 2017 · 0 comments
Open

Comments

@dbukhmastov
Copy link
Contributor

dbukhmastov commented Jul 26, 2017

Scenario:

local numberOfRequests = 6;
local app = Rocky({"timeout": 6});
local count = 0;
app.on("GET", "/test", function(context) {
    // do nothing
}.bindenv(this));
imp.wakeup(0, function() {
    for (local i = 0; i < numberOfRequests; i++) {
        local req = http.request("GET", http.agenturl() + "/test", {}, "body");
        req.sendasync(function(res) {
            server.log("Response #" + (++count) + " | statuscode=" + res.statuscode);
        }.bindenv(this));
    }   
}.bindenv(this));
imp.wakeup(2, function() {
    Rocky.sendToAll(200, {"message": "OK"});
    imp.wakeup(2, function() {
        server.log("Total responses: " + count + "/" + numberOfRequests);
    }.bindenv(this));
}.bindenv(this));

Log:

[Agent] Response #1 | statuscode=200
[Agent] Response #2 | statuscode=200
[Agent] Response #3 | statuscode=200
[Agent] Response #4 | statuscode=200
[Agent] Total responses: 4/6
[Agent] Response #5 | statuscode=500
[Agent] Response #6 | statuscode=500

Tests:

This issue affects class: tests/AsyncRequests.agent.test.nut method: testMultipleAsyncRequestsWithSendToAll()

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

1 participant