Skip to content

Conversation

@vafada
Copy link
Contributor

@vafada vafada commented Nov 17, 2025

Fixes #23508.

This PR adds onFinished param callback for SessionImpl::updateTrackersFromURL function.

The onFinished call back is called when setAdditionalTrackersFromURL is called or when the download of the tracker list failed.

This fixes the async issue when qBittorent is launched via CLI with the following conditions:

  1. --skip-dialog=true
  2. a torrent file or magnet url is specified to be downloaded
  3. user has Automatically append trackers from URL to new downloads: set

In master, on app launch, an async task is started to download the url set in AdditionalTrackersURL. Meanwhile, the application would process the CLI params and immediately start the download of the torrent file or magnet url specified in the CLI param even before the download task finishes. This bug makes the Automatically append trackers from URL to new downloads: feature not work properly if the torrent download was triggered via CLI and if add torrent dialog is skipped.

With this PR, if the AdditionalTrackersURL is set, we wait for the download task to finish before starting up the session.

caveats

  • if the url set in AdditionalTrackersURL is invalid, it would take 30 seconds for the app to startup since the default timeout for the http request is 30 seconds

request.setTransferTimeout();

  • it would be nice to only do
updateTrackersFromURL([this]()
        {
            prepareStartup();
        });

if the CLI param has --skip-dialog=true and has a url param, but the sessionimpl class has no access to CLI params

Comment on lines +695 to +698
updateTrackersFromURL([this]()
{
prepareStartup();
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't call it a good idea to perform tasks sequentially that are ideal candidates for parallel execution. It seems that the issue requires a slightly more advanced solution. (Of course, if it's worth the effort. #23508 doesn't seem to have a large enough coverage so we could consider it as a known limitation rather than a bug.)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have an idea. I’ll give it a try when the chance arises.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry to bother, is there any update on this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry to bother, is there any update on this?

I have an idea. I’ll give it a try when the chance arises.

There still wasn't time to do it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, wouldn't it be an acceptable compromise to just keep a list of downloaded trackers stored between sessions? Then it would always be available at startup, although it would probably be outdated, but it is unlikely that it is updated so often that this would be a problem.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@glassez do you suggest storing the list of tracker urls in qBittorrent.conf ? If yes, maybe a can take a stab at this

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@glassez do you suggest storing the list of tracker urls in qBittorrent.conf ?

Well, certainly not in qBittorrent.conf. In a separate txt file in the qBittorrent data folder.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

CLI doesn't append trackers from URL

3 participants