m-lab / ndt7-js

Apache License 2.0
22 stars 17 forks source link

Fix upload termination bug #18

Closed robertodauria closed 3 years ago

robertodauria commented 3 years ago

This PR should fix the issue we are seeing with Firefox at the end of the upload test.

The issue was caused by the call to sock.close() which means waiting for the socket buffer to be completely sent to the ndt7 server. However, after 15 seconds the server abruptly closes the socket. I believe the same happens on other browsers such as Google Chrome but it isn't displayed in that case.

The changes in this PR make sure that the upload webworker is always terminated after 10 seconds, and that the complete callback gets called whether the webworker was terminated by a sock.close() or the 10-second timeout -- usually the latter.


This change is Reviewable