Commit Graph

16 Commits

Author SHA1 Message Date
48a3a206a3 Reduce resource usage of metadata update task
This task previously read all images file's EXIF data every 60s, which
leads to a very large CPU usage for seaf_fuse.

The obvious fix of checking for modifications times and only read the
change files does not work with seaf_fuse, because stat is not cheaper
than actually opening and reading the file.

So instead, we now only read the file list and the modification time of
the image directory itself and update the image metadata only if there
are changes. We also update the metadata at least once every hour to
detect modified files on normal filesystems.

Interestingly, seaf_fuse will update the mtime of a directory if any file
in that directory is changed, so the logic implemented in this commit
will actually detect image changes with seaf_fuse instantly.
2024-01-21 17:42:22 +01:00
68c7fd2ac4 Limit number of parallel image conversions
Tokio will happy start hundreds of parallel image conversions, which
overwhelms seaf_fuse, so limit the parallel conversion to 4 using a
semaphore.
2024-01-21 17:39:55 +01:00
17d0bae1aa Fix parsing of exif datetimes
We previously tried to parse the exif datetime as an ISO datetime
string, however the date parse uses colons instead of dashes in exif.
This meant that the modification time was used for every image instead
of the exif date.
2023-04-21 23:08:36 +02:00
03ab64ddbc Fix spelling mistake in example config 2023-04-07 00:43:16 +02:00
8f004e5e65 Add support for config file in image directory
This config file will be loaded together with the images and defines the
passwords for login and some other parameters.
2023-04-07 00:37:54 +02:00
68f50b5292 Use MemoryStore for sessions to be able to clear sessions 2023-04-07 00:23:15 +02:00
9af4831efa Add cache for image info list
Preparing the images list involves reading a directory (which might be
slow on non-local directories) and opening every file to read the exif
data. To avoid having to do this on every request, we do it every 60s in
a background job and only read from the cache on requests.
2023-04-06 22:11:12 +02:00
6206d0ea58 Use std RwLock instead of the tokio one
tokio recommends to use the std synchronization primitives if the locked
value is just data instead of a shared resource.
2023-04-06 22:06:29 +02:00
a7ade951aa Print listening address as info 2023-03-20 00:17:34 +01:00
be24603fff Add simple in-memory cache for encoded images 2023-03-20 00:17:10 +01:00
b2207e4f48 Switch to jemalloc to reduce memory usage 2023-03-20 00:13:34 +01:00
9b6a12f3da Sort images by creation date read from EXIF or file modify date 2023-03-13 23:10:14 +01:00
0480943093 Use encrypt image names in html 2023-03-13 21:33:29 +01:00
81b7339634 Implement basic error handling with anyhow 2023-03-12 21:11:30 +01:00
02dcb9d5d0 Fix some clippy lints 2023-03-10 22:00:51 +01:00
0af84a1ce8 Import initial working prototype 2023-03-10 19:00:12 +01:00