You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -329,6 +329,8 @@ SafePgMigrations.config.safe_timeout = 5.seconds # Statement timeout used for al
329
329
330
330
SafePgMigrations.config.lock_timeout =nil# Lock timeout used for all DDL operations except from CREATE / DROP INDEX. If not set, safe_timeout will be used with a deduction of 1% to ensure that the lock timeout is raised in priority
331
331
332
+
SafePgMigrations.config.max_lock_timeout_for_retry =1.second # Max lock timeout for the retries for all DDL operations except from CREATE / DROP INDEX. Each retry will increase the lock_timeout by (max_lock_timeout_for_retry - lock_timeout) / max_tries
333
+
332
334
SafePgMigrations.config.blocking_activity_logger_verbose =true# Outputs the raw blocking queries on timeout. When false, outputs information about the lock instead
333
335
334
336
SafePgMigrations.config.sensitive_logger =nil# When given, sensitive data will be sent to this logger instead of the standard output. Must implement method `info`.
raise'Setting lock timeout to 0 disables the lock timeout and is dangerous'ifvalue == 0.seconds
37
35
38
-
unlessvalue.nil? || value < safe_timeout
39
-
raiseArgumentError,"Lock timeout (#{value}) cannot be greater than safe timeout (#{safe_timeout})"
36
+
unlessvalue.nil? || (value < safe_timeout && value < max_lock_timeout_on_retry)
37
+
raiseArgumentError,"Lock timeout (#{value}) cannot be greater than the safe timeout (#{safe_timeout}) or the max lock timeout for retry (#{max_lock_timeout_for_retry})"
40
38
end
41
39
42
40
@lock_timeout=value
43
41
end
44
42
45
43
defsafe_timeout=(value)
46
-
raise'Setting safe timeout to 0 disables the safe timeout and is dangerous'unlessvalue
44
+
raise'Setting safe timeout to 0 or nil disables the safe timeout and is dangerous'unlessvalue && value > 0.seconds
47
45
48
-
unlesslock_timeout.nil? || value > lock_timeout||value > max_lock_timeout
49
-
raiseArgumentError,"Safe timeout (#{value}) cannot be less than lock timeout (#{lock_timeout})"
raiseArgumentError,"Safe timeout (#{value}) cannot be lower than the lock timeout (#{lock_timeout}) or the max lock timeout for retry (#{max_lock_timeout_for_retry})"
50
48
end
51
49
52
50
@safe_timeout=value
53
51
end
54
52
53
+
defmax_lock_timeout_for_retry(value)
54
+
unlesslock_timeout.nil? || (value > lock_timeout && value < safe_timeout)
55
+
raiseArgumentError,"Max lock timeout for retry (#{value}) cannot be lower than the lock timeout (#{lock_timeout}) and greater than the safe timeout (#{safe_timeout})"
0 commit comments