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

It's confusing that speedtest.New() uses the same GlobalDataManager #154

Open
eric opened this issue Oct 26, 2023 · 3 comments
Open

It's confusing that speedtest.New() uses the same GlobalDataManager #154

eric opened this issue Oct 26, 2023 · 3 comments

Comments

@eric
Copy link
Contributor

eric commented Oct 26, 2023

I assumed that each instance of the Speedtest object would have its own state, but it turned out it shared the GlobalDataManager which needed to be reset between runs to be able to give accurate results.

@r3inbowari
Copy link
Collaborator

Hi, @eric. You are right. we fixed it and cache records of the last ten tests. reset is still needed.

@eric
Copy link
Contributor Author

eric commented Oct 27, 2023

Originally I did not have a Reset() when the test was done (it still is unintuitive to me why I would need a Reset() when I am creating a new object each time) and the numbers I was getting on the second run were 2x the actual numbers. I assumed that speedtest.New() created a new session, but maybe introducing some sort of a session object for each test run would be a simpler way to understand from someone coming to the project for the first time.

@eric
Copy link
Contributor Author

eric commented Oct 27, 2023

Reading through #155 and the examples, I now see that with the change, if I were to throw away the Speedtest object after each run and I am only testing one host, it is not required that I call Reset().

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

No branches or pull requests

2 participants