Merge "Remove spawn_after"

This commit is contained in:
Zuul
2026-02-18 14:01:19 +00:00
committed by Gerrit Code Review
2 changed files with 0 additions and 26 deletions
-12
View File
@@ -1560,18 +1560,6 @@ class SpawnOnTestCase(test.NoDBTestCase):
'test_spawn_on_warns_on_full_executor.cell_worker', task)
class SpawnAfterTestCase(test.NoDBTestCase):
@mock.patch.object(time, "sleep")
def test_spawn_after_submits_work_after_delay(self, mock_sleep):
task = mock.MagicMock()
future = utils.spawn_after(0.1, task, 13, foo='bar')
future.result()
task.assert_called_once_with(13, foo='bar')
mock_sleep.assert_called_once_with(0.1)
class ExecutorStatsTestCase(test.NoDBTestCase):
def setUp(self):
-14
View File
@@ -587,20 +587,6 @@ def spawn(
return spawn_on(_get_default_executor(), func, *args, **kwargs)
def spawn_after(
seconds: float,
func: ty.Callable[..., ty.Any],
*args: ty.Any, **kwargs: ty.Any
) -> futurist.Future:
"""Executing the function asynchronously after the given time."""
def delayed(*args, **kwargs):
time.sleep(seconds)
return func(*args, **kwargs)
return spawn(delayed, *args, **kwargs)
def _executor_is_full(executor: Executor) -> bool:
if concurrency_mode_threading():
# TODO(gibi): Move this whole logic to futurist ThreadPoolExecutor