diff --git a/src/references/Cesxhin.AnimeManga.Domain/DTO/DiskSpaceDTO.cs b/src/references/Cesxhin.AnimeManga.Domain/DTO/DiskSpaceDTO.cs deleted file mode 100644 index a5753a4..0000000 --- a/src/references/Cesxhin.AnimeManga.Domain/DTO/DiskSpaceDTO.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace Cesxhin.AnimeManga.Domain.DTO -{ - public class DiskSpaceDTO - { - public long DiskSizeTotal { get; set; } - public long DiskSizeFree { get; set; } - public int Interval { get; set; } - public long LastCheck { get; set; } - } -} diff --git a/src/references/Cesxhin.AnimeManga.Domain/DTO/HealthDTO.cs b/src/references/Cesxhin.AnimeManga.Domain/DTO/HealthDTO.cs deleted file mode 100644 index 4b82932..0000000 --- a/src/references/Cesxhin.AnimeManga.Domain/DTO/HealthDTO.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Cesxhin.AnimeManga.Domain.DTO -{ - public class HealthDTO - { - public string NameService { get; set; } - public long LastCheck { get; set; } - public int Interval { get; set; } - } -} diff --git a/src/references/Cesxhin.AnimeManga.Modules/CronJob/HealthJob.cs b/src/references/Cesxhin.AnimeManga.Modules/CronJob/HealthJob.cs deleted file mode 100644 index 6c9944b..0000000 --- a/src/references/Cesxhin.AnimeManga.Modules/CronJob/HealthJob.cs +++ /dev/null @@ -1,39 +0,0 @@ -using Cesxhin.AnimeManga.Modules.Exceptions; -using Cesxhin.AnimeManga.Modules.Generic; -using Cesxhin.AnimeManga.Modules.NlogManager; -using Cesxhin.AnimeManga.Domain.DTO; -using NLog; -using Quartz; -using System; -using System.Threading.Tasks; - -namespace Cesxhin.AnimeManga.Modules.CronJob -{ - public class HealthJob : IJob - { - //log - private readonly NLogConsole _logger = new(LogManager.GetCurrentClassLogger()); - - public Task Execute(IJobExecutionContext context) - { - Api api = new(); - - try - { - api.PutOne("/health", new HealthDTO - { - NameService = context.JobDetail.Key.Name.ToLower(), - LastCheck = new DateTimeOffset(DateTime.Now).ToUnixTimeMilliseconds(), - Interval = 60000 - }).GetAwaiter().GetResult(); - - } - catch (ApiGenericException ex) - { - _logger.Fatal($"Error api, error details: {ex.Message}"); - } - - return Task.CompletedTask; - } - } -} diff --git a/src/references/Cesxhin.AnimeManga.Modules/CronJob/SpaceDiskJob.cs b/src/references/Cesxhin.AnimeManga.Modules/CronJob/SpaceDiskJob.cs deleted file mode 100644 index b14fe8a..0000000 --- a/src/references/Cesxhin.AnimeManga.Modules/CronJob/SpaceDiskJob.cs +++ /dev/null @@ -1,48 +0,0 @@ -using Cesxhin.AnimeManga.Modules.Exceptions; -using Cesxhin.AnimeManga.Modules.Generic; -using Cesxhin.AnimeManga.Modules.NlogManager; -using Cesxhin.AnimeManga.Domain.DTO; -using NLog; -using Quartz; -using System; -using System.IO; -using System.Threading.Tasks; - -namespace Cesxhin.AnimeManga.Modules.CronJob -{ - public class SpaceDiskJob : IJob - { - private readonly string _folder = Environment.GetEnvironmentVariable("BASE_PATH") ?? "/"; - - //log - private readonly NLogConsole _logger = new(LogManager.GetCurrentClassLogger()); - - - public Task Execute(IJobExecutionContext context) - { - Api checkDiskFreeSpaceApi = new(); - - //check disk space free (byte to gigabyte) - var freeGigabytes = new DriveInfo(_folder).AvailableFreeSpace / 1000000000; - var totalGigabytes = new DriveInfo(_folder).TotalSize / 1000000000; - - try - { - checkDiskFreeSpaceApi.PutOne("/disk", new DiskSpaceDTO - { - DiskSizeFree = freeGigabytes, - DiskSizeTotal = totalGigabytes, - Interval = 60000 - }).GetAwaiter().GetResult(); - - _logger.Info("Ok send done status space disk"); - } - catch (ApiGenericException ex) - { - _logger.Fatal($"Error send api DiskSpace, details error: {ex.Message}"); - } - - return Task.CompletedTask; - } - } -}