eikek / eikek/docspell

Jobs that suceed on the last try create items stuck at processing state

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

Description

## Steps:

1. Pick some file that can be successfully processed.
2. Adjust the environment, so that the file succeeds on the last try. (Trivial way: set `retries = 0`)
3. Upload the file.

## Expected results

The job is successful and the item is created.

## Actual results

The job is successful, but the item isn't visible. When I look into the DB, the item is still in `processing` state.

## Analysis

IIUC, in case of isLastRetry, the job is processed in slightly different way.

a. When some retries are remaining, the item state is updated (`.flatMap(itemStateTask(store, ItemState.Created))`)
b. When no retry is remaining and the job fails, the state is also updates (`.flatMap(_ => itemStateTask(store, ItemState.Created)(data))`)
c. When no retry is remaining and the job succeeds, I don't see such code.

In my case, I had `retries=0`, because it creates more readable logs (exceptions aren't repeated for each attempt). With retries>0, you usually don't hit the bug, as most jobs probably either succeed at the first attempt or fail on all attempts.

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.