def process_submitted_deque(): global processing_trackers processing_trackers = True while submitted_trackers: with deque_lock: tracker = submitted_trackers.popleft() logger.info(f"Size of queue: {len(submitted_trackers)}") process_new_tracker(tracker) save_deque_to_disk(submitted_data, submitted_history_file) logger.info("Finished processing new trackers") processing_trackers = False
def update_outdated_trackers(): while True: now = int(time()) trackers_outdated = [] for tracker in db.get_all_data(): if (now - tracker.last_checked) > tracker.interval: trackers_outdated.append(tracker) for tracker in trackers_outdated: logger.info(f"Updating {tracker.url}") tracker.update_status() db.update_tracker(tracker) save_deque_to_disk(raw_data, raw_history_file) detect_new_ip_duplicates() sleep(5)