This commit is contained in:
@@ -13,17 +13,33 @@ namespace AyaNova.Biz
|
||||
private static ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger("CoreJobTempFolderCleanup");
|
||||
|
||||
private static DateTime _lastRun = DateTime.UtcNow;
|
||||
private static TimeSpan tsRunEvery = new TimeSpan(0, 5, 2);//every this minutes run the cleanup task
|
||||
|
||||
|
||||
#if (DEBUG)
|
||||
private static TimeSpan RUN_EVERY_INTERVAL = new TimeSpan(0, 0, 21);//no more frequently than once every 20 seconds
|
||||
#else
|
||||
private static TimeSpan RUN_EVERY_INTERVAL = new TimeSpan(0, 5, 2);//no more frequently than once every 5 minutes
|
||||
#endif
|
||||
|
||||
// private static TimeSpan tsRunEvery = new TimeSpan(0, 5, 2);//every this minutes run the cleanup task
|
||||
|
||||
//erase any files found to be older than 15 minutes (which coincides with max report rendering timeout)
|
||||
#if (DEBUG)
|
||||
private static TimeSpan DELETE_IF_OLDER_THAN = new TimeSpan(0, 2, 1);//2 minutes max
|
||||
#else
|
||||
private static TimeSpan DELETE_IF_OLDER_THAN = new TimeSpan(0, 15, 1);
|
||||
#endif
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
public static void DoWork()
|
||||
{
|
||||
if (DateUtil.IsAfterDuration(_lastRun, tsRunEvery))
|
||||
if (DateUtil.IsAfterDuration(_lastRun, RUN_EVERY_INTERVAL))
|
||||
{
|
||||
log.LogDebug("Temp cleanup now");
|
||||
FileUtil.CleanTemporaryFilesFolder(new TimeSpan(0,15,0));//erase any files found to be older than 15 minutes (which coincides with max report rendering timeout)
|
||||
FileUtil.CleanTemporaryFilesFolder(DELETE_IF_OLDER_THAN);
|
||||
var now = DateTime.UtcNow;
|
||||
_lastRun = now;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user