mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-13 00:32:57 -07:00
Changed the way we download the .zip files in the auto updater #1460 This might make a difference to the permissions issue. but not 100% sure.
Also lowered the retrying of jobs to default to 5, but updater to retry only once.
This commit is contained in:
parent
ec57c5f0cd
commit
247d708e7a
5 changed files with 29 additions and 16 deletions
|
@ -5,9 +5,11 @@ using System.IO;
|
|||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading.Tasks;
|
||||
using Hangfire;
|
||||
using Hangfire.Console;
|
||||
using Hangfire.Server;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
@ -52,6 +54,7 @@ namespace Ombi.Schedule.Jobs.Ombi
|
|||
|
||||
}
|
||||
|
||||
[AutomaticRetry(Attempts = 1)]
|
||||
public async Task Update(PerformContext c)
|
||||
{
|
||||
Ctx = c;
|
||||
|
@ -217,11 +220,23 @@ namespace Ombi.Schedule.Jobs.Ombi
|
|||
}
|
||||
}
|
||||
|
||||
public static async Task DownloadAsync(string requestUri, string filename, PerformContext ctx)
|
||||
public async Task DownloadAsync(string requestUri, string filename, PerformContext ctx)
|
||||
{
|
||||
using (var client = new WebClient())
|
||||
Logger.LogDebug("Starting the DownloadAsync");
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
await client.DownloadFileTaskAsync(requestUri, filename);
|
||||
using (var result = await client.GetAsync(requestUri))
|
||||
{
|
||||
if (result.IsSuccessStatusCode)
|
||||
{
|
||||
var contentStream = await result.Content.ReadAsStreamAsync();
|
||||
using (var stream =
|
||||
new FileStream(filename, FileMode.Create, FileAccess.Write, FileShare.None))
|
||||
{
|
||||
await contentStream.CopyToAsync(stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ using AutoMapper;
|
|||
using Hangfire;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
@ -20,7 +19,6 @@ using Ombi.Core.Claims;
|
|||
using Ombi.Core.Helpers;
|
||||
using Ombi.Core.Models.UI;
|
||||
using Ombi.Core.Settings;
|
||||
using Ombi.Helpers;
|
||||
using Ombi.Models;
|
||||
using Ombi.Models.Identity;
|
||||
using Ombi.Notifications;
|
||||
|
@ -29,7 +27,6 @@ using Ombi.Schedule.Jobs.Ombi;
|
|||
using Ombi.Settings.Settings.Models;
|
||||
using Ombi.Settings.Settings.Models.Notifications;
|
||||
using Ombi.Store.Entities;
|
||||
using Ombi.Store.Repository;
|
||||
using OmbiIdentityResult = Ombi.Models.Identity.IdentityResult;
|
||||
|
||||
namespace Ombi.Controllers
|
||||
|
|
|
@ -58,7 +58,7 @@ namespace Ombi
|
|||
.MinimumLevel.Information()
|
||||
|
||||
.WriteTo.RollingFile(Path.Combine(env.ContentRootPath, "Logs", "log-{Date}.txt"))
|
||||
.WriteTo.SQLite("Ombi.db", "Logs", LogEventLevel.Information)
|
||||
.WriteTo.SQLite("Ombi.db", "Logs", LogEventLevel.Debug)
|
||||
.CreateLogger();
|
||||
}
|
||||
else
|
||||
|
@ -67,7 +67,7 @@ namespace Ombi
|
|||
.MinimumLevel.Information()
|
||||
|
||||
.WriteTo.RollingFile(Path.Combine(StoragePath.StoragePath, "Logs", "log-{Date}.txt"))
|
||||
.WriteTo.SQLite(Path.Combine(StoragePath.StoragePath, "Ombi.db"), "Logs", LogEventLevel.Information)
|
||||
.WriteTo.SQLite(Path.Combine(StoragePath.StoragePath, "Ombi.db"), "Logs", LogEventLevel.Debug)
|
||||
.CreateLogger();
|
||||
}
|
||||
Log.Logger = config;
|
||||
|
@ -179,6 +179,7 @@ namespace Ombi
|
|||
{
|
||||
Authorization = new[] { new HangfireAuthorizationFilter() }
|
||||
});
|
||||
GlobalJobFilters.Filters.Add(new AutomaticRetryAttribute { Attempts = 3 });
|
||||
|
||||
// Setup the scheduler
|
||||
var jobSetup = app.ApplicationServices.GetService<IJobSetup>();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue