From f6341be8734a6d143dfc591e92d694cb4f763050 Mon Sep 17 00:00:00 2001 From: Matthew Keeler Date: Mon, 12 Aug 2024 14:59:25 -0400 Subject: [PATCH] wip --- .github/workflows/ci.yml | 9 +++++++++ Makefile | 2 +- ldclient/impl/integrations/files/file_data_source.py | 7 +++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8f3d6169..bb9731d2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,6 +49,15 @@ jobs: - name: Run tests run: make test + - run: make test + - run: make test + - run: make test + - run: make test + - run: make test + - run: make test + - run: make test + - run: make test + - name: Verify typehints run: make lint diff --git a/Makefile b/Makefile index fc211437..589bf82b 100644 --- a/Makefile +++ b/Makefile @@ -28,7 +28,7 @@ install: .PHONY: test test: #! Run unit tests test: install - @poetry run pytest $(PYTEST_FLAGS) + @poetry run pytest $(PYTEST_FLAGS) ldclient/testing/test_file_data_source.py::test_reloads_modified_file_in_polling_mode .PHONY: lint lint: #! Run type analysis and linting checks diff --git a/ldclient/impl/integrations/files/file_data_source.py b/ldclient/impl/integrations/files/file_data_source.py index d02d5b28..b83ef07e 100644 --- a/ldclient/impl/integrations/files/file_data_source.py +++ b/ldclient/impl/integrations/files/file_data_source.py @@ -2,8 +2,11 @@ import os import traceback import time +from logging import getLogger from typing import Optional +logger = getLogger('@@@@@') + have_yaml = False try: import yaml @@ -191,17 +194,21 @@ def __init__(self, resolved_paths, reloader, interval): self._file_times = self._check_file_times() self._timer = RepeatingTask(interval, interval, self._poll) self._timer.start() + logger.warning('Using the polling file watcher because the watchdog package is not installed') def stop(self): self._timer.stop() def _poll(self): + logger.warning('Polling for changes to data files') new_times = self._check_file_times() changed = False for file_path, file_time in self._file_times.items(): if new_times.get(file_path) is not None and new_times.get(file_path) != file_time: + logger.warning('CHANGES detected in %s' % file_path) changed = True break + logger.warning('No changes detected in %s' % file_path) self._file_times = new_times if changed: self._reloader()