1
Vote

Getting files list is 1000x slower because of a typo + update speed improvement

description

torrents.cs:
 
    internal DateTime FilesLastUpdated
    {
        get
        {
            return _filesLastUpdated;
        }
        set
        {
            _filesLastUpdated = FilesLastUpdated;
        }
    }
 
should be
 
    internal DateTime FilesLastUpdated
    {
        get
        {
            return _filesLastUpdated;
        }
        set
        {
            _filesLastUpdated = value;
        }
    }
 
 
utorrentwebclient.cs:
public UTorrentWebClient(string ServerAddress, string UserName, string Password, bool AutoUpdate, Dispatcher Dispatcher)
...
MinimumTimeBetweenUpdates = TimeSpan.FromSeconds(20);
That was just 2 seconds making it possible that it would lose the cache while still doing processing.
 
internal void SetTorrentFilePriority(TorrentFile FileToUpdate, int Priority)
...
UpdateTorrentFiles(FileToUpdate.ParentCollection.ParentTorrent, false); //*** true -> false
 
That being true caused every update to the Priority to also re-fetch the same file info which is already in the cache. This change will likely need additional fixes to ensure the local cache is up to date re: the priority.
 
 
Since currently the priorities are set one by one, this causes utorrent to max out the CPU after these changes have been done. To fix this there needs to be a way to batch transfer the new priorities to utorrent. Unfortunately since this is done using WCF it is not atleast immediately clear how this should be done.
 
Here's the batch set prio doc and js sample:
 
http://[IP]:[PORT]/gui/?action=setprio&hash=[TORRENT HASH]&p=[PRIORITY]&f=[FILE INDEX] This action sets the priority for the specified file(s) in the torrent job.
  • The possible priority levels are the values returned by "getfiles".
  • A file is specified using the zero-based index of the file in the inside the list returned by "getfiles".
  • Only one priority level may be specified on each call to this action, but multiple files may be specified.
    *
     
    setPriority: function (b, a) {
    this.request("action=setprio&hash=" + b + "&p=" + a + "&f=" + this.getFileIds(b, a).join("&f="))
    },

comments

droidi wrote Jan 15, 2010 at 12:52 PM

added stuff about batching the updates. Any ideas how ?

wrote Feb 14, 2013 at 12:51 AM