diff options
author | Jesse Luehrs <doy@tozt.net> | 2021-12-27 20:54:47 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2021-12-27 20:54:47 -0500 |
commit | 5af66045cba333f81f5b7b0603aa6136c095381e (patch) | |
tree | 380298d2b360d954c51153c5cb513cee143dd790 /modules/tick | |
parent | e634a4d21c17995947dfed96a41dd4e4d08cd260 (diff) | |
download | puppet-tozt-5af66045cba333f81f5b7b0603aa6136c095381e.tar.gz puppet-tozt-5af66045cba333f81f5b7b0603aa6136c095381e.zip |
stop using so many backblaze api calls
Diffstat (limited to 'modules/tick')
-rw-r--r-- | modules/tick/files/plugins/rclone | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/modules/tick/files/plugins/rclone b/modules/tick/files/plugins/rclone index 757369d..c26a190 100644 --- a/modules/tick/files/plugins/rclone +++ b/modules/tick/files/plugins/rclone @@ -13,11 +13,14 @@ JSON.load(%x{#{rclone} lsjson #{crypt_repo}}).each do |dir| b2_path = "#{b2_repo}/#{dir["Path"]}" date = %x{#{rclone} cat #{crypt_path}/last_run} - data = JSON.load(%x{#{rclone} size #{b2_path} --b2-versions --json}) - ago_s = now - DateTime.iso8601(date).to_time - file_size_b = data["bytes"] - file_count_n = data["count"] - puts "rclone,location=#{crypt_path} days_since_last_run=#{ago_s / 60.0 / 60.0 / 24.0},file_size=#{file_size_b}i,file_count=#{file_count_n}i" + # rclone size uses quite a lot of backblaze api calls, which turns out to be + # super expensive + # data = JSON.load(%x{#{rclone} size #{b2_path} --b2-versions --json}) + # file_size_b = data["bytes"] + # file_count_n = data["count"] + + # puts "rclone,location=#{crypt_path} days_since_last_run=#{ago_s / 60.0 / 60.0 / 24.0},file_size=#{file_size_b}i,file_count=#{file_count_n}i" + puts "rclone,location=#{crypt_path} days_since_last_run=#{ago_s / 60.0 / 60.0 / 24.0}" end |