Skip to content

Commit

Permalink
improve caching
Browse files Browse the repository at this point in the history
  • Loading branch information
blakeblackshear committed Jun 9, 2024
1 parent d275d72 commit 550fce3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions docker/main/rootfs/usr/local/nginx/conf/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ http {
image/jpeg jpg;
}

expires 7d;
add_header Cache-Control "public";
autoindex on;
root /media/frigate;
}
Expand Down
2 changes: 1 addition & 1 deletion frigate/api/media.py
Original file line number Diff line number Diff line change
Expand Up @@ -1232,7 +1232,7 @@ def preview_gif(camera_name: str, start_ts, end_ts, max_cache_age=2592000):

@MediaBp.route("/<camera_name>/start/<int:start_ts>/end/<int:end_ts>/preview.mp4")
@MediaBp.route("/<camera_name>/start/<float:start_ts>/end/<float:end_ts>/preview.mp4")
def preview_mp4(camera_name: str, start_ts, end_ts, max_cache_age=2592000):
def preview_mp4(camera_name: str, start_ts, end_ts, max_cache_age=604800):
file_name = f"preview_{camera_name}_{start_ts}-{end_ts}.mp4"

if len(file_name) > 1000:
Expand Down

0 comments on commit 550fce3

Please sign in to comment.