Refs #30213 -- Removed post-startup check for Watchman availability.
This is checked at startup in get_reloader(). The runtime check ties the implementation to Watchman excessively.
This commit is contained in:
parent
35911078fa
commit
e34dfad0a3
|
@ -657,16 +657,7 @@ def start_django(reloader, main_func, *args, **kwargs):
|
|||
django_main_thread.start()
|
||||
|
||||
while not reloader.should_stop:
|
||||
try:
|
||||
reloader.run(django_main_thread)
|
||||
except WatchmanUnavailable as ex:
|
||||
# It's possible that the watchman service shuts down or otherwise
|
||||
# becomes unavailable. In that case, use the StatReloader.
|
||||
reloader = StatReloader()
|
||||
logger.error("Error connecting to Watchman: %s", ex)
|
||||
logger.info(
|
||||
"Watching for file changes with %s", reloader.__class__.__name__
|
||||
)
|
||||
|
||||
|
||||
def run_with_reloader(main_func, *args, **kwargs):
|
||||
|
|
|
@ -381,16 +381,6 @@ class RunWithReloaderTests(SimpleTestCase):
|
|||
|
||||
|
||||
class StartDjangoTests(SimpleTestCase):
|
||||
@mock.patch("django.utils.autoreload.StatReloader")
|
||||
def test_watchman_becomes_unavailable(self, mocked_stat):
|
||||
mocked_stat.should_stop.return_value = True
|
||||
fake_reloader = mock.MagicMock()
|
||||
fake_reloader.should_stop = False
|
||||
fake_reloader.run.side_effect = autoreload.WatchmanUnavailable()
|
||||
|
||||
autoreload.start_django(fake_reloader, lambda: None)
|
||||
self.assertEqual(mocked_stat.call_count, 1)
|
||||
|
||||
@mock.patch("django.utils.autoreload.ensure_echo_on")
|
||||
def test_echo_on_called(self, mocked_echo):
|
||||
fake_reloader = mock.MagicMock()
|
||||
|
|
Loading…
Reference in New Issue