Skip to content

Issue with sendBatchTimeout and using protractor #186

@Emilio-K

Description

@Emilio-K

Hi, I am using jsnlog for angular 6, and I have got everything working. However when I try to do e2e tests with it, there is an issue with the sendBatchTimeout.

Protractor is waiting for all angular tasks to finish which includes the sendBatchTimeout, which will have a default value of max integer, so the tests will never run because of this timeout going on. Inside jsnlog.js in the function setTimer, I have made a change to adjust for this, if timeoutMs is the default value which is 2147483647 then it doesn't set a timeout.

if(timeoutMs !== 2147483647){ 
                timer.id = setTimeout(function () {
                    // use call to ensure that the this as used inside sendBatch when it runs is the
                    // same this at this point.
                    callback.call(that);
                }, timeoutMs);
}

Is there anything like this you would consider adding to the src? Because I would like to use sendBatch but not have that infinite timer nor send them before it reaches the batch size.

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions