Skip to content

fix(jobs): mirror sync killed by 1-minute default timeout, leaving repos in broken state #803

@dvrd

Description

@dvrd

Summary

Mirror sync commands (git fetch --prune and git remote update --prune) in pkg/jobs/mirror.go inherit the 1-minute DefaultTimeout from the git-module library because no explicit timeout is set. For repos whose network fetch takes longer than 1 minute, the git process is killed mid-transfer: --prune has already removed local refs that no longer exist on remote, but new/renamed remote refs were never fully fetched before the timeout. The result is missing or stale branches.

Root cause

// pkg/jobs/mirror.go
cmd := git.NewCommand(args...).WithContext(ctx)
// No .WithTimeout(-1) → falls through to DefaultTimeout = 1 minute

The initial import in ImportRepository correctly sets Timeout: -1 (no timeout) to allow arbitrarily large clones. The sync job never applies this same protection.

Fix

Add .WithTimeout(-1) to both sync commands, mirroring the clone behavior.

Closes #633

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions