Commit 5ea374fe authored by Michael Kozono's avatar Michael Kozono

Guarantee the earliest key

parent 07e79989
......@@ -20,7 +20,7 @@ module Gitlab
end
def add_keys_since(cutoff_datetime)
start_key = Key.select(:id).where("created_at >= ?", cutoff_datetime).take
start_key = Key.select(:id).where("created_at >= ?", cutoff_datetime).order('id ASC').take
if start_key
batch_add_keys_in_db_starting_from(start_key.id)
end
......
......@@ -49,6 +49,7 @@ describe Gitlab::BackgroundMigration::UpdateAuthorizedKeysFileSince do
before do
Timecop.travel 1.day.from_now
@key = create(:key)
create(:key) # other key
end
it 'calls batch_add_keys_in_db_starting_from with the start key ID' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment