File tree Expand file tree Collapse file tree 1 file changed +21
-13
lines changed Expand file tree Collapse file tree 1 file changed +21
-13
lines changed Original file line number Diff line number Diff line change @@ -187,6 +187,8 @@ def set_initial_data
187187 end
188188
189189 def run
190+ kill_sessions
191+
190192 test_spec = UsingHash [ self . test_spec ]
191193 ops = test_spec . use! ( 'operations' )
192194 execute_operations ( ops )
@@ -207,19 +209,7 @@ def stop?
207209
208210 def cleanup
209211 if $kill_transactions || true
210- begin
211- root_authorized_client . command (
212- killAllSessions : [ ] ,
213- )
214- rescue Mongo ::Error ::OperationFailure => e
215- if e . code == 11601
216- # operation was interrupted, ignore
217- elsif e . code == 59
218- # no such command (old server), ignore
219- else
220- raise
221- end
222- end
212+ kill_sessions
223213 $kill_transactions = nil
224214 end
225215
@@ -333,6 +323,24 @@ def disable_fail_points
333323 end
334324 end
335325
326+ def kill_sessions
327+ if options [ :kill_sessions ] != false
328+ begin
329+ root_authorized_client . command (
330+ killAllSessions : [ ] ,
331+ )
332+ rescue Mongo ::Error ::OperationFailure => e
333+ if e . code == 11601
334+ # operation was interrupted, ignore
335+ elsif e . code == 59
336+ # no such command (old server), ignore
337+ else
338+ raise
339+ end
340+ end
341+ end
342+ end
343+
336344 def root_authorized_client
337345 @root_authorized_client ||= ClientRegistry . instance . global_client ( 'root_authorized' )
338346 end
You can’t perform that action at this time.
0 commit comments