beetbox / beetbox/beets

chroma: Abort fingerprinting immediately on SIGINT

Open
#3,139 2 comments 1 reaction 0 assignees View on GitHub
chroma feature
Dominant language
Python
Stars
15.7k
Forks
2.1k
Avg merge
4d 21h
Merged PRs (30d)
31

Description

### Problem

Steps to reproduce:

1. Create a directory with lots of MP3 files (at least 10)
2. Run `beet import` on the directory.
3. Press CTRL+C.
4. Watch for a while as Beets fingerprints every file in the directory before exiting.

The same issue occurs when the 'aBort' option is selected from the autotag prompt.

I reproduced the issue using the following config file:

```
directory: /tmp/beets-testcase
library: /tmp/beets-testcase/db

plugins: chroma

import:
timid: yes
```

### 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 the `Pipeline.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.

Contributor guide

Open the contributing guide

Research direction

Start by inspecting the chroma plugin's fingerprint_file() task and Pipeline.run_parallel(), then reproduce the SIGINT and autotag 'aBort' cases with the configuration shown. Done means aborting stops fingerprinting promptly instead of waiting for every file, allowing Beets to exit quickly.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.