Commit 3648854f authored by Andreas Brandl's avatar Andreas Brandl

Set statement timeout in seconds

parent 37b08fe6
......@@ -111,7 +111,7 @@ module Gitlab
end
def set_statement_timeout
execute("SET statement_timeout TO #{STATEMENT_TIMEOUT}")
execute("SET statement_timeout TO '%ds'" % STATEMENT_TIMEOUT)
yield
ensure
execute('RESET statement_timeout')
......
......@@ -111,7 +111,7 @@ RSpec.describe Gitlab::Database::Reindexing::ConcurrentReindex, '#perform' do
end
it 'replaces the existing index with an identical index' do
expect(connection).to receive(:execute).with('SET statement_timeout TO 21600').twice
expect(connection).to receive(:execute).with('SET statement_timeout TO \'21600s\'').twice
expect_to_execute_concurrently_in_order(create_index)
......@@ -136,7 +136,7 @@ RSpec.describe Gitlab::Database::Reindexing::ConcurrentReindex, '#perform' do
end
it 'replaces the existing index with an identical index' do
expect(connection).to receive(:execute).with('SET statement_timeout TO 21600').exactly(3).times
expect(connection).to receive(:execute).with('SET statement_timeout TO \'21600s\'').exactly(3).times
expect_to_execute_concurrently_in_order(drop_index)
expect_to_execute_concurrently_in_order(create_index)
......
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