sidekiq-heartbeat_monitor 1.0.3.0 → 1.0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/sidekiq/heartbeat_monitor/util.rb +20 -7
- data/lib/sidekiq/heartbeat_monitor/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 94ac413bdcca367c06df67dbb4b8ed922814031b
|
4
|
+
data.tar.gz: 317491055dd7b4caaaeeb03485af086ea9999b42
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 38887358fc7d9489421273c1fa9c66996d5127bf9c40dae0216f9b380b9e72903db1b98529970454bae2137c0a5009e492660da9282058a84349e8d03760c721
|
7
|
+
data.tar.gz: 5c4cab171ad4c1425e100afbecda3f3169ea4db109eb0b318ab0f1469df8205a614ab9337c15f80c80377f5dbad021331555a486293faa1d9bca68a434d0aba4
|
@@ -3,16 +3,29 @@ module Sidekiq
|
|
3
3
|
module HeartbeatMonitor
|
4
4
|
module Util
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
##
|
7
|
+
# Nicely formats a seconds string.
|
8
|
+
# Example 1: 100.seconds => "1 min 40 sec"
|
9
|
+
# Example 2: 13.hours => "13 hr"
|
10
|
+
#
|
11
|
+
# @param total_seconds [String] Total number of seconds to format nicely.
|
12
|
+
# @return [String] A string representation of the time.
|
13
|
+
def format_time_str(total_seconds)
|
14
|
+
remaining_sec = total_seconds
|
10
15
|
|
11
|
-
|
12
|
-
|
16
|
+
hours = (remaining_sec - (remaining_sec % 3600)) / 3600
|
17
|
+
remaining_sec -= hours * 3600
|
18
|
+
|
19
|
+
minutes = (remaining_sec - (remaining_sec % 60)) / 60
|
20
|
+
remaining_sec -= minutes * 60
|
21
|
+
|
22
|
+
seconds = remaining_sec
|
23
|
+
|
24
|
+
nice_backed_up_str = "#{seconds} sec" if seconds > 0 || (minutes < 1 && hours < 1)
|
25
|
+
nice_backed_up_str = "#{minutes} min #{nice_backed_up_str}" if minutes > 0 || (seconds > 0 && hours > 0)
|
13
26
|
nice_backed_up_str = "#{hours} hr #{nice_backed_up_str}" if hours > 0
|
14
27
|
|
15
|
-
nice_backed_up_str
|
28
|
+
nice_backed_up_str.strip
|
16
29
|
end
|
17
30
|
|
18
31
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sidekiq-heartbeat_monitor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.3.
|
4
|
+
version: 1.0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jay El-Kaake
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-01-
|
11
|
+
date: 2020-01-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sidekiq
|