Skip to content

Add transfer retries and batches#1664

Merged
jpdillingham merged 37 commits into
masterfrom
retries
Apr 24, 2026
Merged

Add transfer retries and batches#1664
jpdillingham merged 37 commits into
masterfrom
retries

Conversation

@jpdillingham

@jpdillingham jpdillingham commented Mar 7, 2026

Copy link
Copy Markdown
Member

This PR adds retries for transfers, along with the ability to resume partially downloaded files.

Here are the docs:

Retry Behavior

Failed downloads can be retried automatically up to the configured number of attempts. If an attempt fails initially, the application delays the second attempt by the configured delay, and an exponential backoff is used to compute the delay for all subsequent events, up to the configured maximum delay.

By default, partial downloads are resumed based on the size of the incomplete file. Users can choose to always overwrite files if they wish.

YAML

transfers:
  download:
    retry:
      incomplete: resume # 'overwrite' or 'resume'
      attempts: 3
      delay: 5000 # initial time between retries, in milliseconds
      max_delay: 60000 # maximum time between retries, in milliseconds

This PR also introduces a BatchId column for Transfers, but doesn't do anything with it yet.

Testing

I ran another copy of slskd with the following adjustment to the upload code:

governor: (tx, req, ct) =>
{
    if (Random.Shared.NextDouble() < 0.5)
    {
        Log.Error("Unlucky!!!");
        throw new Exception("unlucky");
    }
    return Governor.GetBytesAsync(tx.Username, req, ct);
},

This gives uploads a 50% chance of failing each time the governor is asked for a block of bytes, which is every iteration of the send loop. With this in place, I downloaded a directory:

image

Each file failed and was automatically retried, up to 96 times. I found and fixed a bug with progress reporting in Soulseek.NET here, and with that, everything seems to be working perfectly.

Source files:

image

Downloaded files:

image

@jpdillingham jpdillingham added the breaking change This is a breaking change label Mar 7, 2026
@jpdillingham jpdillingham merged commit 14f94a4 into master Apr 24, 2026
6 checks passed
@jpdillingham jpdillingham deleted the retries branch April 24, 2026 23:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant