[Enhancement]: Speed up the removal process #659

Closed
opened 2026-04-24 23:16:22 +02:00 by adam · 6 comments
Owner

Originally created by @raviwarrier on GitHub (Sep 27, 2022).

Describe the feature/enhancement

image
I took that snip about 10-12m back and after that much time, only 30 books have been removed so far...

image

It shouldn't take so long to remove books (just removing them from the library database), especially considering that adding books takes significantly lesser time.

Originally created by @raviwarrier on GitHub (Sep 27, 2022). ### Describe the feature/enhancement ![image](https://user-images.githubusercontent.com/42061703/192435675-e35abafd-a32d-4a9f-b4eb-b30d587b14ed.png) I took that snip about 10-12m back and after that much time, only 30 books have been removed so far... ![image](https://user-images.githubusercontent.com/42061703/192435745-da8c9c5d-f27e-439c-bdc7-54e1b6727bd2.png) It shouldn't take so long to remove books (just removing them from the library database), especially considering that adding books takes significantly lesser time.
adam added the enhancement label 2026-04-24 23:16:22 +02:00
adam closed this issue 2026-04-24 23:16:22 +02:00
Author
Owner

@raviwarrier commented on GitHub (Sep 27, 2022):

Tested it for 120 seconds (2m) in that time only 6 books were deleted.
image

@raviwarrier commented on GitHub (Sep 27, 2022): Tested it for 120 seconds (2m) in that time only 6 books were deleted. ![image](https://user-images.githubusercontent.com/42061703/192436365-e84ed53d-27d5-4ac5-bd81-1388b02b0d2b.png)
Author
Owner

@raviwarrier commented on GitHub (Sep 27, 2022):

Surprisingly the log shows an average of 6-7s to remove a book and I can't explain why only 6 books were deleted in 120s in the comment above.

image

Nevertheless, at 7s each for 2400, I am looking at 280m to have them removed, which is still too long, especially, if I cannot navigate away from the page.

@raviwarrier commented on GitHub (Sep 27, 2022): Surprisingly the log shows an average of 6-7s to remove a book and I can't explain why only 6 books were deleted in 120s in the comment above. ![image](https://user-images.githubusercontent.com/42061703/192437644-38972f2a-eab1-41db-a13e-a5cf8b0daf95.png) Nevertheless, at 7s each for 2400, I am looking at 280m to have them removed, which is still too long, especially, if I cannot navigate away from the page.
Author
Owner

@advplyr commented on GitHub (Sep 27, 2022):

This is not the case for me. Maybe you have some issues with your file system?

When removing a library item this is the process:

  1. Loop through users and if the user has progress for that item then remove it
  2. Loop through collections and remove the book if it is in a collection
  3. Purge cover cache for that item in /metadata/cache/covers/
  4. Remove the item from the db

If you turn on debug logs then there would be some more logs here we might be able to see which step is getting hung up.

Are your /metadata and /config folders network drives or in the same place?

@advplyr commented on GitHub (Sep 27, 2022): This is not the case for me. Maybe you have some issues with your file system? When removing a library item this is the process: 1. Loop through users and if the user has progress for that item then remove it 2. Loop through collections and remove the book if it is in a collection 3. Purge cover cache for that item in `/metadata/cache/covers/` 4. Remove the item from the db If you turn on debug logs then there would be some more logs here we might be able to see which step is getting hung up. Are your `/metadata` and `/config` folders network drives or in the same place?
Author
Owner

@raviwarrier commented on GitHub (Sep 27, 2022):

Ah... makes sense that it takes 6-7s.

I host ABS on my RPI. My /config /metadata and /books are all on the SSD attached to the RPI and I connect to it from my Windows laptop via the browser: so, I don't know how to answer that question. It is local to RPI but remote to my Windows laptop.

Since there is a good reason for the slowness of removing books (even if it is for only me), you can close this issue. :)

@raviwarrier commented on GitHub (Sep 27, 2022): Ah... makes sense that it takes 6-7s. I host ABS on my RPI. My /config /metadata and /books are all on the SSD attached to the RPI and I connect to it from my Windows laptop via the browser: so, I don't know how to answer that question. It is local to RPI but remote to my Windows laptop. Since there is a good reason for the slowness of removing books (even if it is for only me), you can close this issue. :)
Author
Owner

@advplyr commented on GitHub (Sep 27, 2022):

That is really slow though so something is definitely off here. My suggestion would be to keep debug logs turned on (going to config -> logs and choose debug in the dropdown), then the next time you have to remove books like that share the logs.

@advplyr commented on GitHub (Sep 27, 2022): That is really slow though so something is definitely off here. My suggestion would be to keep debug logs turned on (going to config -> logs and choose debug in the dropdown), then the next time you have to remove books like that share the logs.
Author
Owner

@raviwarrier commented on GitHub (Sep 27, 2022):

Turned the debug log on. If you want I can do that over the weekend, but instead of removing 2400, i'll try with just 50 books first. Will share those logs here then. Cheers, buddy.

@raviwarrier commented on GitHub (Sep 27, 2022): Turned the debug log on. If you want I can do that over the weekend, but instead of removing 2400, i'll try with just 50 books first. Will share those logs here then. Cheers, buddy.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#659