Cambios mensajes
This commit is contained in:
43
Servicio Gestion Asegasa/ProcesosConf.cs
Normal file
43
Servicio Gestion Asegasa/ProcesosConf.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user