diff --git a/nova/tests/unit/test_utils.py b/nova/tests/unit/test_utils.py index b086e2266a..1d71693cab 100644 --- a/nova/tests/unit/test_utils.py +++ b/nova/tests/unit/test_utils.py @@ -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): diff --git a/nova/utils.py b/nova/utils.py index 35ee8ad6ee..75ae131235 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -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