1
Fork 0
Commit Graph

522 Commits

Author SHA1 Message Date
Lajos Koszti 1f8664d7f8
fix transaction already commited error
I encountered with the following error:

> 2023/02/05 07:33:00 /app/scanner/face_detection/face_detector.go:92 sql: transaction has already been committed or rolled back
> [0.042ms] [rows:0] SELECT * FROM `media` WHERE `media`.`id` = 823 ORDER BY `media`.`id` LIMIT 1
> 2023/02/05 07:33:00 ERROR: Error detecting faces in image (/photos/Borzsony2017/DSC_0028.NEF): sql: transaction has already been committed or rolled back

It turned out it comes from the api/routes/photos.go

I found a very similar code in album_scanner.go.
The difference I saw was that while in the single photo request the
transaction passed to the `scanner_tasks.Tasks.BeforeProcessMedia` call,
in the album_scann.go the transaction created after this call and
created from the context which returned by `BeforeProcessMedia`.

Another difference was that in the `ProcessSingleMedia` call the
`AfterProcessMedia` call was called with the same - db transaction -
context, in the album_scanner it was called outside of the transaction.

I changed the logic by merging the two behavior:
Create the transaction from the context of `BeforeProcessMedia` and also
use the transaction context in the `AfterProcessMedia`.
After the change the error disappeared.

So to have it in a common place I extracted that logic into a function
and use for both the single photo request and in the album scanner.

I did not go more deeper to find out what's going on with the context
under the hood.
2023-02-05 09:05:05 +01:00
queeup a797170881 Add Turkish language 2022-12-02 15:32:49 +03:00
PJ-Watson 5c1bbf9065
Fixed ScanAlbum failing silently.
2.3.12 -> 2.3.13 restructured ScanAlbum so that errors were returned rather than raising a ScannerError directly - this ensures that the errors are logged correctly.
2022-08-12 02:18:59 +01:00
PJ-Watson 7715865309 Add support for .CR3 photos. 2022-08-10 07:43:39 +01:00
PJ-Watson ca889d02bd Fixed site_info_test - missing model import. 2022-08-09 06:43:25 +01:00
PJ-Watson 3e780dbe48 Changed downsampling method to custom type. 2022-08-09 06:09:55 +01:00
PJ-Watson 1c784fa5e9 Simple api test 2022-08-05 19:40:26 +01:00
PJ-Watson 5c4eeef870 Introduce thumbnail filtering options. 2022-08-05 19:37:55 +01:00
viktorstrate 831e24f654
Fix API tests 2022-07-08 17:44:03 +02:00
viktorstrate a5d152f0c0
Make scanner tasks share ctx 2022-07-07 22:00:05 +02:00
viktorstrate f512db6c32
Merge branch 'master' into rework-scanner-internals 2022-07-07 19:58:30 +02:00
viktorstrate 248d858592
Add Basque language
Thank you to Xabi for the translation
2022-07-05 15:11:49 +02:00
viktorstrate 447f05185f
Fix scanner queue tests 2022-03-28 18:43:00 +02:00
James Cross 501c50e259 Adding image description to sidebar 2022-03-28 16:08:30 +01:00
Phlogi f093827bde
Fix slow query in getting media of a face by using another join
The subquery returns all potential media id's. Typically, we have a couple of faces and thousands of media files. 
A join is much faster. 

With about 50k images and a face that was present in 2'000 images the query was unusable slow, it took about 60s. 
This is a very important performance fix, as I think many users will run into it. 
Maybe there are other areas where the same improvement is possible, I didn't check.
2022-03-05 17:44:15 +01:00
viktorstrate b09d32019e
Make it compile again 2022-03-02 17:26:06 +01:00
viktorstrate 6e2a64bc77
WIP: split up scanner into separate tasks 2022-02-15 17:22:41 +01:00
viktorstrate 6361df1793
Start on big scanner code refactoring 2022-02-14 23:57:45 +01:00
viktorstrate e9a4839f48
Fix Postgres exif flash migration error message
Closes #648
2022-02-13 16:57:20 +01:00
viktorstrate a24f2ef019
If possible expand root album, write tests 2022-02-07 19:41:44 +01:00
viktorstrate 5ffc1a57dd
Reconnect custom websocket upgrader 2022-02-07 18:15:47 +01:00
viktorstrate ee5c113c32
Add EXIF modify dates as a fallback for create dates 2022-02-07 17:57:10 +01:00
viktorstrate f2f75c03b3
Add more keys for potential create dates to exiftool 2022-02-07 17:44:45 +01:00
viktorstrate b593f615ad
Better graphql schema documentation 2022-02-05 01:21:00 +01:00
viktorstrate b49333ae69
Add Media.GetThumbnail() tests 2022-02-02 00:03:31 +01:00
viktorstrate 0d9760b33f
Integrate blurhashes with UI 2022-02-01 23:39:19 +01:00
viktorstrate b4ad1c4f88
Add blurhash generation 2022-02-01 22:02:08 +01:00
viktorstrate 722e639bb1
Update go and node dependencies.
- Refactor UI to work with v6 of react-router
2022-01-31 22:32:17 +01:00
viktorstrate e509124510
Disable 'media already scanned' logs 2021-11-21 11:41:52 +01:00
viktorstrate c5a307283d
Refactoring of API
- Add request context to all database calls
- Update deprecated gqlgen functions
- Update go.mod dependencies
2021-11-11 18:57:02 +01:00
viktorstrate 12085698c8
Refactoring + disable cleanup tests for sqlite 2021-11-06 15:41:25 +01:00
viktorstrate 6545a04225
Add tests for modifying media on disk 2021-11-06 13:30:23 +01:00
viktorstrate 0618b70110
Enable foreign keys for sqlite 2021-11-06 13:23:59 +01:00
viktorstrate c48ede175a
Fix exif circular imports in tests 2021-11-06 13:01:01 +01:00
viktorstrate 3040daafb6
Fix tests 2021-11-06 12:38:05 +01:00
viktorstrate b467f2ca61
Add failing test for #198 2021-11-06 12:23:47 +01:00
viktorstrate 06fd166483
Sidebar: people section + album path 2021-10-19 23:28:23 +02:00
viktorstrate b5be84bbe4
Make mapbox map more reusable + add coordinates to exif 2021-10-03 15:36:10 +02:00
viktorstrate f3223005b1
Add bigint as correct type for exif migrations 2021-10-02 17:05:47 +02:00
viktorstrate f6cc86d75a
Fix bug 2021-09-30 16:05:23 +02:00
viktorstrate d060ee9fd9
Write failing test for bug 2021-09-29 11:20:15 +02:00
viktorstrate c977f076db
Fix timeline for sqlite 2021-09-27 21:26:30 +02:00
viktorstrate bb19d18c42
Add test for user favorite media 2021-09-27 21:20:47 +02:00
viktorstrate 00e436a518
Add tests for album path 2021-09-27 20:59:41 +02:00
viktorstrate c7865a94e4
Fix problem with postgres for MyTimeline action 2021-09-27 20:43:26 +02:00
viktorstrate e66a9199a1
Add timeline resolver tests 2021-09-27 20:23:10 +02:00
viktorstrate 7799674b74
Fix album downloads when running production 2021-09-26 15:15:31 +02:00
viktorstrate 68b6a49638
Fix timeline ordering (#531) + layout fixes for AlbumBox 2021-09-26 13:42:00 +02:00
viktorstrate 342f0a31e1
Fix API tests 2021-09-26 13:23:38 +02:00
viktorstrate 929da08ea2
Add UI for album downloads 2021-09-26 13:10:37 +02:00