浏览代码

Use SET LOCAL for timeouts in transactions

Andrew Kane 8 年之前
父节点
当前提交
bcb1b7af67
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      lib/blazer/adapters/sql_adapter.rb

+ 1 - 1
lib/blazer/adapters/sql_adapter.rb

@@ -116,7 +116,7 @@ module Blazer
 
       def set_timeout(timeout)
         if postgresql? || redshift?
-          select_all("SET statement_timeout = #{timeout.to_i * 1000}")
+          select_all("SET #{use_transaction? ? "LOCAL " : ""}statement_timeout = #{timeout.to_i * 1000}")
         elsif mysql?
           select_all("SET max_execution_time = #{timeout.to_i * 1000}")
         else