Skip to content

Commit

Permalink
add some noise
Browse files Browse the repository at this point in the history
  • Loading branch information
keelerm84 committed Aug 13, 2024
1 parent 33e4ee5 commit 0209cb6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ldclient/impl/integrations/files/file_data_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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()
Expand Down
9 changes: 9 additions & 0 deletions ldclient/testing/test_file_data_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import os
from typing import List

from ldclient.impl.util import log

import pytest
import tempfile
import threading
Expand Down Expand Up @@ -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"}}')
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 0209cb6

Please sign in to comment.