about summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2018-10-09 12:11:14 +0200
committerGitHub <noreply@github.com>2018-10-09 12:11:14 +0200
commit4134a10549a833ad5ab18b3c579304919d594ce1 (patch)
tree696f4b453ad029ffda3d0925c484c11b27b95cc6 /lib
parentd0b1369a853dc2e5b7934c148547f71f8d103859 (diff)
parentb368d3c15ddfca983e89ff2858f7f03eb7147d83 (diff)
Merge pull request #770 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'lib')
-rw-r--r--lib/mastodon/migration_helpers.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/mastodon/migration_helpers.rb b/lib/mastodon/migration_helpers.rb
index 5c135685f..f5dc7e1c6 100644
--- a/lib/mastodon/migration_helpers.rb
+++ b/lib/mastodon/migration_helpers.rb
@@ -342,8 +342,8 @@ module Mastodon
 
       say "Migrating #{table_name}.#{column} (~#{total.to_i} rows)"
 
-      started_time = Time.now
-      last_time = Time.now
+      started_time = Time.zone.now
+      last_time = Time.zone.now
       migrated = 0
       loop do
         stop_row = nil
@@ -375,13 +375,13 @@ module Mastodon
         end
 
         migrated += batch_size
-        if Time.now - last_time > 1
+        if Time.zone.now - last_time > 1
           status = "Migrated #{migrated} rows"
 
           percentage = 100.0 * migrated / total
           status += " (~#{sprintf('%.2f', percentage)}%, "
 
-          remaining_time = (100.0 - percentage) * (Time.now - started_time) / percentage
+          remaining_time = (100.0 - percentage) * (Time.zone.now - started_time) / percentage
 
           status += "#{(remaining_time / 60).to_i}:"
           status += sprintf('%02d', remaining_time.to_i % 60)
@@ -397,7 +397,7 @@ module Mastodon
           status += ')'
 
           say status, true
-          last_time = Time.now
+          last_time = Time.zone.now
         end
 
         # There are no more rows left to update.