Adds protection against user-given pollingInterval values#129
Adds protection against user-given pollingInterval values#129
Conversation
|
Please note that there are some comments from related PR #127 need to be addressed. And update to CHANGELOG.md. |
|
We need auto generating CHANGELOG's, this is silly. |
|
Feel free to go prettier after this PR. Maybe a different PR will make it easier to consume. Commit message cannot easily replace changelog entry because:
I am happy to add changelog update for you. And I also help external contributors to write the changelog entry if they missed. |
|
I think we should hold off on this PR until we can define a better polling strategy moving forward. A static polling strategy for http is at odds with the documentation on polling. I think we should correctly implement polling based on the recommendations in the doc (or model them as closely as we can) since it seems like the correct way to move forward. |
|
The documentation on polling suggests that this client is totally out of spec! How long have people been using this and referencing that documentation? |
|
For as long as I can remember. |
|
@justinwilaby I talked with some folks on the Directline services side and they weren't aware of any such spec about the dynamic polling scenarios. It isn't an expectation on their end. They did however say that this would be an important change, showing me some recent usage that would suggest that folks are providing polling intervals as low as 10ms. I recommend we move forward with this. |
9aca5b8 to
74b2496
Compare
src/directLine.ts
Outdated
| if (options.pollingInterval !== undefined) { | ||
| if (options.pollingInterval && | ||
| Math.min(~~options.pollingInterval, POLLING_INTERVAL_LOWER_BOUND) < POLLING_INTERVAL_LOWER_BOUND) { | ||
| console.warn('DirectLineJS: provided pollingInterval is under lower bound (200ms), using default of 1000ms'); |
There was a problem hiding this comment.
It might be nice to include the provided polling interval here, because if it is NaN this message might be confusing.
Currently a client can provide any value for its
pollingInterval, and when it happens to be a number, it can be arbitrary. This exposes both the DirectLineJS client library and the DirectLine API. One could specify apollingIntervalof 1ms and absolutely hammer the DirectLine API. We should prevent that.