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

When paused why try to fetch every 1000 ms? #169

Closed
kadishmal opened this issue Mar 5, 2015 · 2 comments · Fixed by #171
Closed

When paused why try to fetch every 1000 ms? #169

kadishmal opened this issue Mar 5, 2015 · 2 comments · Fixed by #171

Comments

@kadishmal
Copy link
Contributor

In highLevelConsumer.js there is this code:

this.on('done', function (topics) {
    self.updateOffsets(topics);
    if (!self.paused) {
        setImmediate(function () {
            self.fetch();
        });
    }
    else {
        setTimeout(function () {
            self.fetch();
        }, 1000);
    }
});

The .fetch() function is as follows:

HighLevelConsumer.prototype.fetch = function () {
    if (!this.ready || this.rebalancing || this.paused) {
        return;
    }

    this.client.sendFetchRequest(this, this.topicPayloads, this.options.fetchMaxWaitMs, this.options.fetchMinBytes, this.options.maxTickMessages);
}

This means that even if the consumer is paused, it will try to fetch every 1 second:

       setTimeout(function () {
           self.fetch();
       }, 1000);

Why try if the code in .fetch() will just return?

        if (!this.ready || this.rebalancing || this.paused) {
        return;
    }
@kadishmal
Copy link
Contributor Author

@jezzalaycock seems to have written those lines.

@haio
Copy link
Member

haio commented Mar 5, 2015

I think those lines can be removed.

@haio haio closed this as completed in #171 Mar 6, 2015
haio added a commit that referenced this issue Mar 6, 2015
Fix #169: When paused why try to fetch every 1000 ms?
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

Successfully merging a pull request may close this issue.

2 participants