Skip to content
This repository was archived by the owner on Oct 16, 2020. It is now read-only.

Commit f933ab3

Browse files
committed
bot.mirror: convert #nil to #string before parsing to Time.parse
1 parent f06dc3d commit f933ab3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

bot/plugins/mirror.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def mirror_monitor(m, cache_time = 1800)
4545
if _cache_expired?(:mirror, "cron_error", :cache_time => cache_time)
4646
end
4747

48-
offset = Time.now - Time.parse(@curl_data["f"]["the_latest_package_time"])
48+
offset = Time.now - Time.parse(@curl_data["f"]["the_latest_package_time"].to_s)
4949
offset = (offset / 3600).to_i
5050
if offset > 24
5151
m.reply "!! Warning: The last package is updated #{offset} hours ago" \
@@ -94,7 +94,7 @@ def mirror_status(m, msg)
9494
end
9595

9696
@curl_data = mirror_cron(m)
97-
offset = Time.now - Time.parse(@curl_data["f"]["the_latest_package_time"])
97+
offset = Time.now - Time.parse(@curl_data["f"]["the_latest_package_time"].to_s)
9898
offset = (offset / 60).to_i
9999

100100
echo = case msg.strip

0 commit comments

Comments
 (0)