File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -211,20 +211,24 @@ def _check(
211211@pytest .fixture
212212def wait_for_sidekiq (gl ):
213213 """
214- Return a helper function to wait until there are no busy sidekiq processes.
214+ Return a helper function to wait until there are spare sidekiq processes.
215+
216+ Because not all Groups can be deleted immediately in GL 16, we will likely have busy Sidekiq jobs
217+ set aside for their deletion in 1 days time.
215218
216219 Use this with asserts for slow tasks (group/project/user creation/deletion).
217220 """
218221
219222 def _wait (timeout : int = 30 , step : float = 0.5 , allow_fail : bool = False ) -> bool :
220223 for count in range (timeout ):
221224 time .sleep (step )
222- busy = False
223225 processes = gl .sidekiq .process_metrics ()["processes" ]
226+ busy_processes = []
224227 for process in processes :
225228 if process ["busy" ]:
226- busy = True
227- if not busy :
229+ busy_processes .append (process )
230+ # If we have at least one spare process, continue
231+ if not (len (busy_processes ) + 1 ) >= len (processes ):
228232 return True
229233 logging .info (f"sidekiq busy { count } of { timeout } " )
230234 assert allow_fail , "sidekiq process should have terminated but did not."
You can’t perform that action at this time.
0 commit comments