diff --git a/tests/test_webservice.py b/tests/test_webservice.py index a533c97b650926aa05a01e153075597869a7b655..c713cbf8be2e01062f153045fab293fc53a331f9 100644 --- a/tests/test_webservice.py +++ b/tests/test_webservice.py @@ -74,6 +74,6 @@ async def test_wait_on_transfer(tmp_path): 'getfattr', content="""#!{}\nprint('user.status="dCache"')""".format(sys.executable) ) - with mock.patch('asyncio.sleep'), mock_getfattr: + with mock_getfattr: res = await wait_on_transfer(tmp_path, max_tries=1) assert res is True diff --git a/webservice/webservice.py b/webservice/webservice.py index 8ecdae41b3b3b8a74811568c985ab39130ee2b67..21c0bb815d3e24b8a57c1043543a7d580cfa524a 100644 --- a/webservice/webservice.py +++ b/webservice/webservice.py @@ -498,7 +498,6 @@ async def wait_on_transfer(rpath, max_tries=300): # FIXME: if not kafka, then do event-driven, no sleep # wait until files are migrated while True: - await asyncio.sleep(10) retcode, stdout = await run_proc_async([ "getfattr", "-n", "user.status", rpath ]) @@ -507,6 +506,7 @@ async def wait_on_transfer(rpath, max_tries=300): if tries > max_tries: return False tries += 1 + await asyncio.sleep(10) def check_files(in_folder: str,