brechtvdv / adlib2eventstream

https://lodi.ilabt.imec.be/coghent/
Other
5 stars 2 forks source link

Fix global scope issue + prevent infinite loop #15

Closed aatauil closed 3 years ago

aatauil commented 3 years ago

Calling this.fetchWithNTLM() from within itself won't work as the this keyword references the global scope at that point. This is easily fixed by 'caching' this at invocation when it is still scoped to itself. const self = this;

Calling the same function on catch will most likely result in an infinite loop as more often then not when catch has been called the error does not resolve by itself. Momentarily just logging the error but this can be replaced by a retry mechanism with max retry limit if this is more appropriate.

[Note] The else statement of the return statement can also cause an infinite loop