Fixed: Changed the api call for Deluge to reduce the response size preventing a timeout when a lot of torrents are listed.

This commit is contained in:
Taloth Saldono 2014-10-31 14:43:59 +01:00
parent 1cb0bb56cd
commit 764ce3507c
3 changed files with 25 additions and 4 deletions

View File

@ -31,6 +31,8 @@ namespace NzbDrone.Core.Download.Clients.Deluge
public class DelugeProxy : IDelugeProxy
{
private static readonly String[] requiredProperties = new String[] { "hash", "name", "state", "progress", "eta", "message", "is_finished", "save_path", "total_size", "total_done", "time_added", "active_time", "ratio", "is_auto_managed", "stop_at_ratio", "remove_at_ratio", "stop_ratio" };
private readonly Logger _logger;
private string _authPassword;
@ -61,9 +63,11 @@ namespace NzbDrone.Core.Download.Clients.Deluge
{
var filter = new Dictionary<String, Object>();
var response = ProcessRequest<Dictionary<String, DelugeTorrent>>(settings, "core.get_torrents_status", filter, new String[0]);
// TODO: get_torrents_status returns the files as well, which starts to cause deluge timeouts when you get enough season packs.
//var response = ProcessRequest<Dictionary<String, DelugeTorrent>>(settings, "core.get_torrents_status", filter, new String[0]);
var response = ProcessRequest<DelugeUpdateUIResult>(settings, "web.update_ui", requiredProperties, filter);
return response.Result.Values.ToArray();
return response.Result.Torrents.Values.ToArray();
}
public DelugeTorrent[] GetTorrentsByLabel(String label, DelugeSettings settings)
@ -71,9 +75,11 @@ namespace NzbDrone.Core.Download.Clients.Deluge
var filter = new Dictionary<String, Object>();
filter.Add("label", label);
var response = ProcessRequest<Dictionary<String, DelugeTorrent>>(settings, "core.get_torrents_status", filter, new String[0]);
return response.Result.Values.ToArray();
//var response = ProcessRequest<Dictionary<String, DelugeTorrent>>(settings, "core.get_torrents_status", filter, new String[0]);
var response = ProcessRequest<DelugeUpdateUIResult>(settings, "web.update_ui", requiredProperties, filter);
return response.Result.Torrents.Values.ToArray();
}
public String AddTorrentFromMagnet(String magnetLink, DelugeSettings settings)

View File

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NzbDrone.Core.Download.Clients.Deluge
{
public class DelugeUpdateUIResult
{
public Dictionary<String, Object> Stats { get; set; }
public Boolean Connected { get; set; }
public Dictionary<String, DelugeTorrent> Torrents { get; set; }
}
}

View File

@ -287,6 +287,7 @@
<Compile Include="Download\Clients\Deluge\DelugeTorrent.cs" />
<Compile Include="Download\Clients\Deluge\DelugeTorrentStatus.cs" />
<Compile Include="Download\Clients\Deluge\DelugePriority.cs" />
<Compile Include="Download\Clients\Deluge\DelugeUpdateUIResult.cs" />
<Compile Include="Download\Clients\DownloadClientAuthenticationException.cs" />
<Compile Include="Download\Clients\DownloadClientException.cs" />
<Compile Include="Download\Clients\Nzbget\ErrorModel.cs" />