fix: TorBox downloads stuck in 'downloading' state
All checks were successful
CI/CD / Build & Push Docker Image (push) Successful in 1m17s

Fixed race condition where TorBox reports DownloadFinished=true but
Progress < 1.0, causing IsReady() to return false and state to stay
"downloading" instead of transitioning to "pausedUP".

Also added Gitea CI workflow to push images to internal registry.

Fixes: dcy-355

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-28 22:57:36 -08:00
committed by John Ogle
parent 207d43b13f
commit 3a5289cb1d
3 changed files with 69 additions and 1 deletions

55
.gitea/workflows/ci.yml Normal file
View File

@@ -0,0 +1,55 @@
name: CI/CD
on:
push:
branches: [master, main]
pull_request:
branches: [master, main]
workflow_dispatch:
permissions:
contents: read
actions: write
jobs:
build-and-push:
name: Build & Push Docker Image
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
outputs:
image_tag: ${{ steps.meta.outputs.tag }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Generate image metadata
id: meta
run: |
SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7)
echo "tag=${SHORT_SHA}" >> $GITHUB_OUTPUT
echo "Image will be tagged: ${SHORT_SHA}"
- name: Login to registry
run: |
echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login registry.johnogle.info -u ${{ secrets.REGISTRY_USERNAME }} --password-stdin
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: |
registry.johnogle.info/johno/decypharr:${{ steps.meta.outputs.tag }}
registry.johnogle.info/johno/decypharr:latest
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
VERSION=${{ steps.meta.outputs.tag }}
CHANNEL=dev

7
.gitignore vendored
View File

@@ -20,3 +20,10 @@ node_modules/
.venv/
.stignore
.stfolder/**
# Gas Town (added by gt)
.runtime/
.claude/
.logs/
.beads/
state.json

View File

@@ -270,6 +270,12 @@ func (s *Store) partialTorrentUpdate(t *Torrent, debridTorrent *types.Torrent) *
if math.IsNaN(progress) || math.IsInf(progress, 0) {
progress = 0
}
// When debrid reports download complete, force progress to 100% to ensure
// IsReady() returns true. This fixes a race condition where TorBox can report
// DownloadFinished=true but Progress < 1.0, causing state to stay "downloading".
if debridTorrent.Status == "downloaded" {
progress = 1.0
}
sizeCompleted := int64(float64(totalSize) * progress)
var speed int64