Quote:
Originally Posted by chaley
With the help of Kaufman's experiments and logs, I found the problem.
When a device disconnects, calibre writes the metadata cache file to the disc, a process that can take some time if there are a lot of books on the device. For example, for Kaufman with some 6,000 books on the device, writing the cache took around 10 seconds. The write is done in the background as part of the disconnect sequence. The problem is that if the user quits calibre while this write is happening then the write process is killed, leaving the cache with an indeterminate number of entries. If is of course perfectly reasonable to quit calibre after disconnecting, especially as it doesn't indicate that it is busy doing something. I needed to find a way to ensure that quitting "early" doesn't corrupt the cache.
After some discussion with Kovid, I made two changes. The first is to write the cache after metadata is sent to CC, ensuring that the cache file is always "close-to" up-to-date. The second is to write the information to a tmp file then replace the existing cache with that file. This guarantees that the cache is either fully replaced or not touched. Both of these changes are in calibre source now and will be in the next calibre release.
|
This doesn't happen only with CC. I've had the same problem with Kobo driver... till I discovered it and waited patiently a bit prior to close calibre