eikek / eikek/docspell

`docspell-consumedir` (`dsc`) processes files before scanning is complete

Open
#3,223 4 comments 0 reactions 0 assignees View on GitHub
dsc
Dominant language
Elm
Stars
2.3k
Forks
184
Avg merge
8h 2m
Merged PRs (30d)
4

Description

When scanning documents directly into a folder watched by the `docspell-consumedir` container, my scanner creates the file immediately and continues writing to it as each new page is scanned. This causes `dsc` to start processing the file before the scan has finished, resulting in incomplete or corrupted imports.

I can mitigate this somewhat by setting the `dsc watch --delay` option to a large value, but that introduces a trade-off:

* A longer delay allows multi-page scans to finish before processing.
* A shorter delay enables faster curation in Docspell but risks partial file processing.

At the moment, I’ve set a delay of around five minutes and avoid delete or move operations after processing to prevent data loss. However, this is not an ideal or reliable long-term solution.

### Question / Request

Is there a better way to ensure that `docspell-consumedir` only processes files after they are fully written by the scanner?

I wish I could configure my scanner to have an extension suffix (.tmp) for incomplete files, but that doesn't seem to be possible.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.