From 0209cb60209c8b56bcad1603b95c7e084536c49b Mon Sep 17 00:00:00 2001 From: Matthew Keeler Date: Tue, 13 Aug 2024 14:41:58 -0400 Subject: [PATCH] add some noise --- ldclient/impl/integrations/files/file_data_source.py | 4 ++++ ldclient/testing/test_file_data_source.py | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/ldclient/impl/integrations/files/file_data_source.py b/ldclient/impl/integrations/files/file_data_source.py index dbdbbfb..df4a66b 100644 --- a/ldclient/impl/integrations/files/file_data_source.py +++ b/ldclient/impl/integrations/files/file_data_source.py @@ -80,6 +80,7 @@ def initialized(self): return self._inited def _load_all(self): + log.error('@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ calling _load_all') all_data = { FEATURES: {}, SEGMENTS: {} } for path in self._paths: try: @@ -162,11 +163,14 @@ def _start_auto_updater(self): # if available for the current platform. class WatchdogAutoUpdater: def __init__(self, resolved_paths, reloader): + log.error('@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ calling WatchdogAutoUpdater') watched_files = set(resolved_paths) class LDWatchdogHandler(watchdog.events.FileSystemEventHandler): def on_any_event(self, event): + log.error('@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ calling on_any_event with event %s' % event) if event.src_path in watched_files: + log.error('@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ calling reloader') reloader() dir_paths = set() diff --git a/ldclient/testing/test_file_data_source.py b/ldclient/testing/test_file_data_source.py index 90f96ef..1c20eef 100644 --- a/ldclient/testing/test_file_data_source.py +++ b/ldclient/testing/test_file_data_source.py @@ -2,6 +2,8 @@ import os from typing import List +from ldclient.impl.util import log + import pytest import tempfile import threading @@ -117,8 +119,11 @@ def make_temp_file(content): return path def replace_file(path, content): + log.error('@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ making a new temp file') temp_path = make_temp_file(content) + log.error('@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ renaming temp file from %s to %s' % (temp_path, path)) os.rename(temp_path, path) + log.error('@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ done') def test_does_not_load_data_prior_to_start(): path = make_temp_file('{"flagValues":{"key":"value"}}') @@ -235,13 +240,17 @@ def test_does_not_reload_modified_file_if_auto_update_is_off(): os.remove(path) def do_auto_update_test(options): + log.error('@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ preparing to make flag file') path = make_temp_file(flag_only_json) + log.error('@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ flag file made with path %s' % path) options['paths'] = path try: source = make_data_source(Config("SDK_KEY"), **options) + log.error('@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ starting the data source') source.start() assert len(store.all(SEGMENTS, lambda x: x)) == 0 time.sleep(0.5) + log.error('@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ replacing the file') replace_file(path, segment_only_json) deadline = time.time() + 20 while time.time() < deadline: