@@ -79,7 +79,10 @@ def log_blocking_queries
79
79
if queries . empty?
80
80
SafePgMigrations . say 'Could not find any blocking query.' , true
81
81
else
82
-
82
+ SafePgMigrations . say (
83
+ "Statement was being blocked by the following #{ 'query' . pluralize ( queries . size ) } :" , true
84
+ )
85
+ SafePgMigrations . say '' , true
83
86
output_blocking_queries ( queries )
84
87
SafePgMigrations . say (
85
88
'Beware, some of those queries might run in a transaction. In this case the locking query might be ' \
@@ -94,20 +97,16 @@ def log_blocking_queries
94
97
95
98
def output_blocking_queries ( queries )
96
99
if SafePgMigrations . config . blocking_activity_logger_verbose
97
- SafePgMigrations . say (
98
- "Statement was being blocked by the following #{ 'query' . pluralize ( queries . size ) } :" , true
99
- )
100
- SafePgMigrations . say '' , true
101
- queries . each do |query , start_time |
102
- SafePgMigrations . say "#{ format_start_time start_time } : #{ query } " , true
103
- end
100
+ queries . each { |query , start_time | SafePgMigrations . say "#{ format_start_time start_time } : #{ query } " , true }
104
101
else
105
102
queries . each do |start_time , locktype , mode , pid , transactionid |
106
- SafePgMigrations . say format_start_time ( start_time ) , true
107
- SafePgMigrations . say "lock type: #{ locktype || 'null' } " , true
108
- SafePgMigrations . say "lock mode: #{ mode || 'null' } " , true
109
- SafePgMigrations . say "lock pid: #{ pid || 'null' } " , true
110
- SafePgMigrations . say "lock transactionid: #{ transactionid || 'null' } " , true
103
+ SafePgMigrations . say (
104
+ "#{ format_start_time ( start_time ) } : lock type: #{ locktype || 'null' } , " \
105
+ "lock mode: #{ mode || 'null' } , " \
106
+ "lock pid: #{ pid || 'null' } , " \
107
+ "lock transactionid: #{ transactionid || 'null' } " ,
108
+ true ,
109
+ )
111
110
end
112
111
end
113
112
end
0 commit comments