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

(maint) Fix progressing-timestamp to progress #3857

Merged
merged 1 commit into from
Aug 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/puppetlabs/puppetdb/cli/benchmark.clj
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,8 @@
:parse-fn #(Integer/parseInt %)]
["-N" "--nummsgs NUMMSGS" "Number of commands and/or reports to send for each host"
:parse-fn #(Long/valueOf %)]
["-e" "--end-commands-in PERIOD" "A period (like '3d') to use to set the ending date of a set of commands"
:default (time/parse-period "7d")
["-e" "--end-commands-in PERIOD" "A period (like '3d') to use to set the ending date of a set of commands. (Usually into the future slightly if you need to account for the time it will take to push a set of historical records into puppetdb)."
:default (time/parse-period "0d")
:parse-fn #(time/parse-period %)]
["-t" "--threads THREADS" "Number of threads to use for command submission"
:default (* 4 (.availableProcessors (Runtime/getRuntime)))
Expand Down Expand Up @@ -454,14 +454,15 @@
(let [run-interval-minutes (time/in-minutes run-interval)
hosts-per-second (/ numhosts (* run-interval-minutes 60))
ms-per-message (/ 1000 hosts-per-second)
ms-per-thread (* ms-per-message simulation-threads)]
ms-per-thread (* ms-per-message simulation-threads)
progressing-timestamp-fn (progressing-timestamp numhosts num-msgs run-interval-minutes end-commands-in)]
(async/pipeline-blocking
simulation-threads
write-ch
(map (fn [host-state]
(when-not num-msgs
(Thread/sleep (int (- ms-per-thread (rand)))))
(update-host host-state rand-perc (progressing-timestamp numhosts num-msgs run-interval-minutes end-commands-in))))
(update-host host-state rand-perc progressing-timestamp-fn)))
read-ch)))

(defn warn-missing-data [catalogs reports facts]
Expand Down
Loading