-
Notifications
You must be signed in to change notification settings - Fork 498
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
(FACT-2815) Added timing for cached facts #2134
Conversation
CLA signed by all contributors. |
.and_return(cached_external_fact) | ||
allow(File).to receive(:mtime).with(File.join(cache_dir, 'ext_file.txt')).and_return(Time.now) | ||
|
||
cache_manager.resolve_facts(searched_facts) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could add an empty line to make the separation between the Arrange, Act and Assertion parts of the unit test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
if Options[:timing] | ||
time = Benchmark.measure { yield } | ||
|
||
puts "fact `#{fact_name}`, took: #{time.format('%r')} seconds" | ||
log = "fact '#{fact_name}', took: #{time.format('%r')} seconds" | ||
puts "#{prefix_message} #{log}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could check if the prefix_message is not empty and a space after it. This way, you'll avoid offsetting the log message with a space
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
Does this PR resolve the inconsistent timing issue of cached facts? |
509bf1e
to
d634ac6
Compare
|
Updated --timing option to also show time needed to read from cached. Before, cached facts were skipped.