chore: Support file data source as initializer and synchronizer#371
Merged
chore: Support file data source as initializer and synchronizer#371
Conversation
| 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: |
There was a problem hiding this comment.
Bug: Polling Misses Inaccessible File Changes
The polling mechanism doesn't detect when a previously accessible file becomes inaccessible. The condition new_times.get(file_path) is not None prevents detecting changes when a file's modification time changes from a valid timestamp to None. This means if a file is deleted or becomes unreadable, the synchronizer won't reload and report an error until the file becomes accessible again or another file changes.
Member
There was a problem hiding this comment.
I assume this is how the existing implementation works, but dependence on file modification timestamp precision isn't amazing.
kinyoklion
reviewed
Nov 17, 2025
| try: | ||
| ret[path] = os.path.getmtime(path) | ||
| except Exception: | ||
| ret[path] = None |
Member
There was a problem hiding this comment.
Do we need any log for this situation?
kinyoklion
approved these changes
Nov 17, 2025
54cbdff to
c0570e2
Compare
keelerm84
added a commit
that referenced
this pull request
Nov 19, 2025
keelerm84
added a commit
that referenced
this pull request
Nov 19, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
Add FDv2 file-based data source implementing Initializer/Synchronizer with auto-update and expose via Files.new_data_source_v2, plus comprehensive tests.
ldclient/impl/integrations/files/file_data_sourcev2.pyimplementing_FileDataSourceV2as both an Initializer (fetch) and Synchronizer (sync) using local files.TRANSFER_FULLChangeSetwithSelector.no_selector()fromflags,flagValues, andsegments(JSON/YAML), ensuring versions and duplicate-key checks._WatchdogAutoUpdaterV2or polling_PollingAutoUpdaterV2withRepeatingTask; emitsUpdatewithVALIDorINTERRUPTEDstates;stop()to clean up.Files.new_data_source_v2(paths, poll_interval, force_polling)returning a builder for FDv2 data system usage; update imports and typing.ldclient/testing/integrations/test_file_data_sourcev2.pycovering initializer and synchronizer (initial load, YAML, multiple files, duplicates, invalid data, file change detection, stop behavior, single-path handling).Written by Cursor Bugbot for commit 5d483f6. This will update automatically on new commits. Configure here.