Be more tolerant of slow GC in the tests
We are seeing more and more random failures on CI as a result of this test (e.g. https://gitlab.cern.ch/scripting-tools/pyjapc/-/jobs/15549590). Instead of an larger absolute timeout, I've added the iterative approach to allow the test to have more time to complete on slower machines, without increasing the test time for quicker ones.