Your ROOT_URL in app.ini is https://git.cloudchain.link/ but you are visiting https://dash.bss.nz/open-source-mirrors/Ombi/commit/d19deea56c10f262ea90e13e6f8e30baf18310ac You should set ROOT_URL correctly, otherwise the web may not work correctly.

Added the transaction back into the DB.

Do not run the episode cacher if it's been run in the last hour
pull/470/head
tidusjar 9 years ago
parent 0b21c69a46
commit d19deea56c

@ -37,7 +37,7 @@ namespace PlexRequests.Core.SettingModels
StoreBackup = 24;
StoreCleanup = 24;
UserRequestLimitResetter = 12;
PlexEpisodeCacher = 2;
PlexEpisodeCacher = 12;
}
public int PlexAvailabilityChecker { get; set; }

@ -49,13 +49,14 @@ namespace PlexRequests.Services.Jobs
public class PlexEpisodeCacher : IJob
{
public PlexEpisodeCacher(ISettingsService<PlexSettings> plexSettings, IPlexApi plex, ICacheProvider cache,
IJobRecord rec, IRepository<PlexEpisodes> repo)
IJobRecord rec, IRepository<PlexEpisodes> repo, ISettingsService<ScheduledJobsSettings> jobs)
{
Plex = plexSettings;
PlexApi = plex;
Cache = cache;
Job = rec;
Repo = repo;
Jobs = jobs;
}
private ISettingsService<PlexSettings> Plex { get; }
@ -64,6 +65,7 @@ namespace PlexRequests.Services.Jobs
private ICacheProvider Cache { get; }
private IJobRecord Job { get; }
private IRepository<PlexEpisodes> Repo { get; }
private ISettingsService<ScheduledJobsSettings> Jobs { get; }
private const int ResultCount = 25;
private const string PlexType = "episode";
private const string TableName = "PlexEpisodes";
@ -142,6 +144,15 @@ namespace PlexRequests.Services.Jobs
{
try
{
var jobs = Job.GetJobs();
var job = jobs.FirstOrDefault(x => x.Name.Equals(JobNames.EpisodeCacher, StringComparison.CurrentCultureIgnoreCase));
if (job != null)
{
if (job.LastRun > DateTime.Now.AddHours(-1)) // If it's been run in the last hour
{
return;
}
}
CacheEpisodes();
}
catch (Exception e)

@ -290,26 +290,17 @@ namespace PlexRequests.Store.Repository
using (var db = Config.DbConnection())
{
db.Open();
//using (var tran = db.BeginTransaction())
//{
Log.Trace("Starting Transaction");
using (var tran = db.BeginTransaction())
{
var result = enumerable.Sum(e => db.Insert(e));
var done = result == enumerable.Length;
Log.Trace($"Total Result: {done}");
Log.Trace($"db result: {result}");
Log.Trace($"totalitems result: {enumerable.Length}");
if (done)
if (result != 0)
{
Log.Trace("Commiting");
//tran.Commit();
tran.Commit();
return true;
}
Log.Trace("Rolling back the tran");
//tran.Rollback();
tran.Rollback();
return false;
//}
}
}
}

Loading…
Cancel
Save