mirror of
				https://github.com/blakeblackshear/frigate.git
				synced 2025-10-27 10:52:11 +01:00 
			
		
		
		
	avoid proactive messages with retain_days 0 and handle first pass
This commit is contained in:
		
							parent
							
								
									543a8a1712
								
							
						
					
					
						commit
						7533f2a8ab
					
				@ -45,6 +45,7 @@ class RecordingMaintainer(threading.Thread):
 | 
				
			|||||||
        self.name = "recording_maint"
 | 
					        self.name = "recording_maint"
 | 
				
			||||||
        self.config = config
 | 
					        self.config = config
 | 
				
			||||||
        self.stop_event = stop_event
 | 
					        self.stop_event = stop_event
 | 
				
			||||||
 | 
					        self.first_pass = True
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def move_files(self):
 | 
					    def move_files(self):
 | 
				
			||||||
        cache_files = [
 | 
					        cache_files = [
 | 
				
			||||||
@ -87,7 +88,10 @@ class RecordingMaintainer(threading.Thread):
 | 
				
			|||||||
                }
 | 
					                }
 | 
				
			||||||
            )
 | 
					            )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # delete all cached files past the most recent 2
 | 
					        # delete all cached files past the most recent 2, but not on the first check
 | 
				
			||||||
 | 
					        if self.first_pass:
 | 
				
			||||||
 | 
					            self.first_pass = False
 | 
				
			||||||
 | 
					        else:
 | 
				
			||||||
            for camera in grouped_recordings.keys():
 | 
					            for camera in grouped_recordings.keys():
 | 
				
			||||||
                if len(grouped_recordings[camera]) > 2:
 | 
					                if len(grouped_recordings[camera]) > 2:
 | 
				
			||||||
                    logger.warning(
 | 
					                    logger.warning(
 | 
				
			||||||
@ -158,7 +162,7 @@ class RecordingMaintainer(threading.Thread):
 | 
				
			|||||||
                    overlaps = False
 | 
					                    overlaps = False
 | 
				
			||||||
                    for event in events:
 | 
					                    for event in events:
 | 
				
			||||||
                        # if the event starts in the future, stop checking events
 | 
					                        # if the event starts in the future, stop checking events
 | 
				
			||||||
                        # and let this recording segment expire
 | 
					                        # and remove this segment
 | 
				
			||||||
                        if event.start_time > end_time.timestamp():
 | 
					                        if event.start_time > end_time.timestamp():
 | 
				
			||||||
                            overlaps = False
 | 
					                            overlaps = False
 | 
				
			||||||
                            break
 | 
					                            break
 | 
				
			||||||
@ -178,6 +182,8 @@ class RecordingMaintainer(threading.Thread):
 | 
				
			|||||||
                            duration,
 | 
					                            duration,
 | 
				
			||||||
                            cache_path,
 | 
					                            cache_path,
 | 
				
			||||||
                        )
 | 
					                        )
 | 
				
			||||||
 | 
					                    else:
 | 
				
			||||||
 | 
					                        Path(cache_path).unlink(missing_ok=True)
 | 
				
			||||||
                # else retain_days includes this segment
 | 
					                # else retain_days includes this segment
 | 
				
			||||||
                else:
 | 
					                else:
 | 
				
			||||||
                    self.store_segment(
 | 
					                    self.store_segment(
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user