Load data from tracer.json file.
(self)
| 36 | self._reload_thread.start() |
| 37 | |
| 38 | def _load_data(self): |
| 39 | """Load data from tracer.json file.""" |
| 40 | if not self.tracer_json_path.exists(): |
| 41 | print(f"Warning: Tracer JSON file not found: {self.tracer_json_path}") |
| 42 | return |
| 43 | |
| 44 | try: |
| 45 | with open(self.tracer_json_path, 'r', encoding='utf-8') as f: |
| 46 | new_records = json.load(f) |
| 47 | |
| 48 | # Update records with thread lock |
| 49 | with self._data_lock: |
| 50 | self.records = new_records |
| 51 | |
| 52 | print(f"Data loaded: {len(self.records)} records from {self.tracer_json_path}") |
| 53 | except Exception as e: |
| 54 | print(f"Error loading data: {e}") |
| 55 | |
| 56 | def _auto_reload_data(self): |
| 57 | """Auto-reload data every 60 seconds in background thread.""" |