44 lines
1.2 KiB
C#
44 lines
1.2 KiB
C#
using Servicio_Gestion_Asegasa.Procesos;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Diagnostics;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Servicio_Gestion_Asegasa
|
|
{
|
|
public class ProcesosConf
|
|
{
|
|
public static Configuracion Conf;
|
|
|
|
public static DateTime? HoraUtcUltimaEjecucionProcesos = null;
|
|
private static bool Procesando;
|
|
|
|
public static async Task ProcesarAsync()
|
|
{
|
|
if (!Procesando && (HoraUtcUltimaEjecucionProcesos.HasValue == false || DateTime.UtcNow.Subtract(HoraUtcUltimaEjecucionProcesos.Value).TotalSeconds > Conf.SegundosMinimosEntreProcesos))
|
|
{
|
|
Procesando = true;
|
|
HoraUtcUltimaEjecucionProcesos = DateTime.UtcNow;
|
|
try
|
|
{
|
|
await ProcesosMensajes.EnviaSMSAsync();
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
|
|
Debug.WriteLine(@"Procesar: EXCEPCIÓN: " + ex.Message + " " + ex.StackTrace);
|
|
}
|
|
finally
|
|
{
|
|
Procesando = false;
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|