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

Replace time.time() with time.monotonic() #1492

Merged
merged 1 commit into from
Jul 23, 2020
Merged

Replace time.time() with time.monotonic() #1492

merged 1 commit into from
Jul 23, 2020

Conversation

max-rocket-internet
Copy link
Contributor

Resolves #1487

I didn't replace it in parts related to stats as I'm not sure of the effect there. So I've replaced in these 3 parts where time is measured by subtracting a previous time from time.time().

FastHttpUser is not affected by this problem in my testing. It uses a timer from the timeit package.

@codecov
Copy link

codecov bot commented Jul 23, 2020

Codecov Report

Merging #1492 into master will increase coverage by 0.37%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1492      +/-   ##
==========================================
+ Coverage   81.13%   81.51%   +0.37%     
==========================================
  Files          27       27              
  Lines        2386     2386              
  Branches      366      366              
==========================================
+ Hits         1936     1945       +9     
+ Misses        356      350       -6     
+ Partials       94       91       -3     
Impacted Files Coverage Δ
locust/clients.py 95.09% <100.00%> (+4.90%) ⬆️
locust/user/task.py 96.21% <0.00%> (+0.54%) ⬆️
locust/runners.py 80.81% <0.00%> (+0.61%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b18cf1e...712203b. Read the comment docs.

@cyberw
Copy link
Collaborator

cyberw commented Jul 23, 2020

I’m merging this because it is an improvement, but maybe we should look in to using timeit (like FastHttpUser is doing)

@cyberw cyberw merged commit a167d2b into locustio:master Jul 23, 2020
@max-rocket-internet max-rocket-internet deleted the fix_time_backwards branch July 23, 2020 20:11
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

Successfully merging this pull request may close these issues.

Negative min_response_time shown in stats
2 participants