pull/733/head
Jamie.Rees 8 years ago
parent cb11267fd2
commit 9f41a511cd

@ -12,6 +12,6 @@ namespace PlexRequests.Core.Queue
IEnumerable<RequestQueue> GetQueue();
Task<IEnumerable<RequestQueue>> GetQueueAsync();
void QueueItem(RequestedModel request, string id, RequestType type, FaultType faultType);
Task QueueItemAsync(RequestedModel request, string id, RequestType type, FaultType faultType);
Task QueueItemAsync(RequestedModel request, string id, RequestType type, FaultType faultType, string message = null);
}
}

@ -74,7 +74,7 @@ namespace PlexRequests.Core.Queue
RequestQueue.Insert(queue);
}
public async Task QueueItemAsync(RequestedModel request, string id, RequestType type, FaultType faultType)
public async Task QueueItemAsync(RequestedModel request, string id, RequestType type, FaultType faultType, string description = null)
{
//Ensure there is not a duplicate queued item
var existingItem = await RequestQueue.CustomAsync(async connection =>
@ -96,7 +96,8 @@ namespace PlexRequests.Core.Queue
Type = type,
Content = ByteConverterHelper.ReturnBytes(request),
PrimaryIdentifier = id,
FaultType = faultType
FaultType = faultType,
Message = description ?? string.Empty
};
await RequestQueue.InsertAsync(queue);
}

@ -41,6 +41,7 @@ namespace PlexRequests.Store.Models
public FaultType FaultType { get; set; }
public DateTime? LastRetry { get; set; }
public string Message { get; set; }
}
public enum FaultType

@ -146,7 +146,8 @@ CREATE TABLE IF NOT EXISTS RequestFaultQueue
Type INTEGER NOT NULL,
FaultType INTEGER NOT NULL,
Content BLOB NOT NULL,
LastRetry VARCHAR(100)
LastRetry VARCHAR(100),
Description VARCHAR(100)
);
CREATE UNIQUE INDEX IF NOT EXISTS PlexUsers_Id ON PlexUsers (Id);

@ -39,6 +39,7 @@ namespace PlexRequests.UI.Models
public string Title { get; set; }
public FaultTypeViewModel FaultType { get; set; }
public DateTime? LastRetry { get; set; }
public string Message { get; set; }
}
public enum RequestTypeViewModel

@ -65,7 +65,8 @@ namespace PlexRequests.UI.Modules.Admin
Title = ByteConverterHelper.ReturnObject<RequestedModel>(r.Content).Title,
Id = r.Id,
PrimaryIdentifier = r.PrimaryIdentifier,
LastRetry = r.LastRetry
LastRetry = r.LastRetry,
Message = r.Message
}).ToList();
return View["RequestFaultQueue", model];

@ -595,7 +595,7 @@ namespace PlexRequests.UI.Modules
catch (Exception e)
{
Log.Fatal(e);
await FaultQueue.QueueItemAsync(model, movieInfo.Id.ToString(), RequestType.Movie, FaultType.RequestFault);
await FaultQueue.QueueItemAsync(model, movieInfo.Id.ToString(), RequestType.Movie, FaultType.RequestFault, e.Message);
await NotificationService.Publish(new NotificationModel
{
@ -866,7 +866,7 @@ namespace PlexRequests.UI.Modules
if (showInfo.externals?.thetvdb == null)
{
await FaultQueue.QueueItemAsync(model, showInfo.id.ToString(), RequestType.TvShow, FaultType.MissingInformation);
await FaultQueue.QueueItemAsync(model, showInfo.id.ToString(), RequestType.TvShow, FaultType.MissingInformation, "We do not have a TheTVDBId from TVMaze");
await NotificationService.Publish(new NotificationModel
{
DateTime = DateTime.Now,
@ -941,7 +941,7 @@ namespace PlexRequests.UI.Modules
}
catch (Exception e)
{
await FaultQueue.QueueItemAsync(model, showInfo.id.ToString(), RequestType.TvShow, FaultType.RequestFault);
await FaultQueue.QueueItemAsync(model, showInfo.id.ToString(), RequestType.TvShow, FaultType.RequestFault, e.Message);
await NotificationService.Publish(new NotificationModel
{
DateTime = DateTime.Now,
@ -1116,7 +1116,7 @@ namespace PlexRequests.UI.Modules
catch (Exception e)
{
Log.Error(e);
await FaultQueue.QueueItemAsync(model, albumInfo.id, RequestType.Album, FaultType.RequestFault);
await FaultQueue.QueueItemAsync(model, albumInfo.id, RequestType.Album, FaultType.RequestFault, e.Message);
await NotificationService.Publish(new NotificationModel
{

@ -20,6 +20,9 @@
<th>
LastRetry
</th>
<th>
Error Description
</th>
</tr>
</thead>
<tbody>
@ -39,6 +42,9 @@
<td>
@m.LastRetry
</td>
<td>
@m.Message
</td>
</tr>
}
</tbody>

@ -110,7 +110,7 @@
var donationText = $("#donationText");
donateLink.attr("href", result.url);
if (result.message) {
donationText.text(result.message);
donationText.text(result.message);
}
}
},

Loading…
Cancel
Save