Open ssssam opened 5 years ago
Sounds good! This would be good behavior to have.
In fact, even without the 'chroma' plugin it seems like the lookup_candidates()
stage could block for a while.
One way to fix this would be to abort Beets without allowing the threads to complete. This could introduce issues like data corruption in tasks which write to files, so it's probably a bad idea.
We could add periodical checks into long running tasks so that they exit if a certain flag is set. What about adding a task.aborted
flag, and inserting blocks such as this in places:
if task.aborted:
return
Problem
Steps to reproduce:
beet import
on the directory.The same issue occurs when the 'aBort' option is selected from the autotag prompt.
I reproduced the issue using the following config file:
Cause
The issue is that the 'chroma' plugin fingerprints every file in the directory during a single
fingerprint_file()
task. This doesn't get aborted when the pipeline receives an exception, so thePipeline.run_parallel()
method blocks until all the files have been fingerprinted.As soon as the task finishes all of this data is thrown away due to the exception, so we should really stop processing files as soon as possible here and allow Beets to exit quickly.