Skip to content

Commit

Permalink
Don't fail on cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
NickM-27 committed Jul 9, 2024
1 parent 78780da commit fba123c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
9 changes: 2 additions & 7 deletions frigate/util/image.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Utilities for creating and manipulating image frames."""

import datetime
import inspect
import logging
import subprocess as sp
from abc import ABC, abstractmethod
Expand Down Expand Up @@ -696,7 +695,6 @@ def create(self, name: str, size) -> AnyStr:
return shm.buf

def get(self, name: str, shape) -> Optional[np.ndarray]:
logger.info(f"retrieving {name} from {inspect.stack()[1].filename} {inspect.stack()[1].function}")
try:
if name in self.shm_store:
shm = self.shm_store[name]
Expand All @@ -708,13 +706,11 @@ def get(self, name: str, shape) -> Optional[np.ndarray]:
return None

def close(self, name: str):
logger.info(f"closing {name}")
if name in self.shm_store:
self.shm_store[name].close()
del self.shm_store[name]

def delete(self, name: str):
logger.info(f"deleting expired {name}")
if name in self.shm_store:
self.shm_store[name].close()

Expand All @@ -725,10 +721,9 @@ def delete(self, name: str):

del self.shm_store[name]
else:
shm = shared_memory.SharedMemory(name=name)
shm.close()

try:
shm = shared_memory.SharedMemory(name=name)
shm.close()
shm.unlink()
except FileNotFoundError:
pass
Expand Down
1 change: 0 additions & 1 deletion frigate/video.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ def capture_frames(
logger.error(f"something video bad happened :: {e}")
frame_manager.delete(frame_name)


# shutdown has been initiated
if stop_event.is_set():
break
Expand Down

0 comments on commit fba123c

Please sign in to comment.