@@ -56,13 +56,6 @@ internal class ControladorRefrescoCache : ControladorServicioGnoss
5656
5757 #region Miembros
5858
59- //private Dictionary<Guid, DateTime> ListaFechasCaducidadComponentes = new Dictionary<Guid, DateTime>();
60-
61- //private Dictionary<Guid, CMSDS.CMSComponenteRow> ListaComponentes = new Dictionary<Guid, CMSDS.CMSComponenteRow>();
62-
63- //private Dictionary<Guid, List<CMSDS.CMSComponenteRow>> ListaComponentesCaducidadRecursoPorProyecto = new Dictionary<Guid, List<CMSDS.CMSComponenteRow>>();
64-
65- //private CMSDS mCmsDS = null;
6659 /// <summary>
6760 /// Almacena la lista de peticiones web actuales por dominio
6861 /// </summary>
@@ -161,7 +154,7 @@ private bool ProcesarItem(string pFila)
161154 filaCola = null ;
162155
163156 ControladorConexiones . CerrarConexiones ( false ) ;
164- UtilPeticion . EliminarObjetosDeHilo ( Thread . CurrentThread . ManagedThreadId ) ;
157+ // UtilPeticion.EliminarObjetosDeHilo(Thread.CurrentThread.ManagedThreadId);
165158 }
166159 return true ;
167160 }
@@ -241,12 +234,12 @@ protected void RealizarMantenimientoRabbitMQ(LoggingService loggingService, bool
241234 mReiniciarLecturaRabbit = true ;
242235 loggingService . GuardarLogError ( ex ) ;
243236 }
244-
245237 }
246238 }
247239
248240 protected void RealizarMantenimientoBaseDatosColas ( )
249241 {
242+
250243 while ( true )
251244 {
252245 using ( var scope = ScopedFactory . CreateScope ( ) )
@@ -264,63 +257,6 @@ protected void RealizarMantenimientoBaseDatosColas()
264257 {
265258 ComprobarCancelacionHilo ( ) ;
266259
267- if ( mReiniciarLecturaRabbit )
268- {
269- RealizarMantenimientoRabbitMQ ( loggingService ) ;
270- }
271-
272- BaseComunidadCN baseComunidadCN = new BaseComunidadCN ( entityContext , loggingService , entityContextBASE , mConfigService , servicesUtilVirtuosoAndReplication ) ;
273- baseComunidadCN . EliminarColaRefrescoCachePendientesRepetidas ( ) ;
274- BaseComunidadDS baseComunidadDS = baseComunidadCN . ObtenerColaRefrescoCachePendientes ( ) ;
275-
276- Dictionary < Guid , List < short > > listaBusquedasRefresco = new Dictionary < Guid , List < short > > ( ) ;
277- foreach ( BaseComunidadDS . ColaRefrescoCacheRow filaCola in baseComunidadDS . ColaRefrescoCache . Rows )
278- {
279- EstaHiloActivo = true ;
280- filaCola . Estado = 0 ;
281-
282- if ( filaCola . TipoEvento == ( short ) TiposEventosRefrescoCache . ModificarCaducidadCache )
283- {
284- try
285- {
286- ProcesarFilaModificarCaducidadCache ( filaCola , entityContext , loggingService , redisCacheWrapper , servicesUtilVirtuosoAndReplication ) ;
287- }
288- catch ( ThreadAbortException ) { }
289- catch ( Exception ex )
290- {
291- filaCola . Estado = 1 ;
292- EnviarCorreoErrorYGuardarLog ( ex , "Error Refresco caché (ProcesarFilaModificarCaducidadCache)" , entityContext , loggingService ) ;
293- }
294- }
295- else
296- {
297- if ( ! listaBusquedasRefresco . ContainsKey ( filaCola . ProyectoID ) )
298- {
299- listaBusquedasRefresco . Add ( filaCola . ProyectoID , new List < short > ( ) ) ;
300- }
301- if ( listaBusquedasRefresco [ filaCola . ProyectoID ] . Contains ( filaCola . TipoBusqueda ) )
302- {
303- baseComunidadCN . EliminarFilaColaRefrescoCache ( filaCola . ColaID ) ;
304- continue ;
305- }
306- else
307- {
308- listaBusquedasRefresco [ filaCola . ProyectoID ] . Add ( filaCola . TipoBusqueda ) ;
309- }
310-
311- ComprobarCancelacionHilo ( ) ;
312-
313- ProcesarFila ( filaCola , entityContext , loggingService , redisCacheWrapper , virtuosoAD , servicesUtilVirtuosoAndReplication ) ;
314- }
315- if ( filaCola . Estado == 0 )
316- {
317- baseComunidadCN . EliminarFilaColaRefrescoCache ( filaCola . ColaID ) ;
318- }
319- else
320- {
321- baseComunidadCN . AcutalizarEstadoColaRefrescoCache ( filaCola . ColaID , filaCola . Estado ) ;
322- }
323- }
324260
325261 List < CMSComponente > listaComponentesRefresco = CargarComponentesCaducados ( entityContext , loggingService , servicesUtilVirtuosoAndReplication ) ;
326262 //Esto lo tengo que hacer en un foreach aparte porque si no salta la excepción de Colleción modificada
@@ -330,8 +266,6 @@ protected void RealizarMantenimientoBaseDatosColas()
330266 }
331267
332268 ComprobarCancelacionHilo ( ) ;
333-
334- //ControladorConexiones.CerrarConexiones(false);
335269 }
336270 catch ( ThreadAbortException ) { }
337271 catch ( OperationCanceledException )
@@ -368,27 +302,9 @@ public override void RealizarMantenimiento(EntityContext entityContext, EntityCo
368302 {
369303 mDominio = mDominio . Substring ( 0 , mDominio . Length - 1 ) ;
370304 }
371- if ( mConfigService . UsarCacheRefreshActiva ( ) )
372- {
373- while ( true )
374- {
375- Task tarea = Task . Factory . StartNew ( ( ) => RealizarMantenimientoRabbitMQ ( loggingService ) ) ;
376-
377- Thread . Sleep ( 60000 ) ; // 1 minuto
378305
379- if ( mRabbitMQClient != null )
380- {
381- mRabbitMQClient . CerrarConexionLectura ( ) ;
382- mRabbitMQClient . Dispose ( ) ;
383- }
384-
385- Thread . Sleep ( 300000 ) ; // 5 minutos
386- }
387- }
388- else
389- {
390- RealizarMantenimientoRabbitMQ ( loggingService ) ;
391- }
306+ Task tarea = Task . Factory . StartNew ( ( ) => RealizarMantenimientoRabbitMQ ( loggingService ) ) ;
307+ Task tarea2 = Task . Factory . StartNew ( ( ) => RealizarMantenimientoBaseDatosColas ( ) ) ;
392308 }
393309
394310 private void ProcesarFila ( BaseComunidadDS . ColaRefrescoCacheRow pFilaCola , EntityContext entityContext , LoggingService loggingService , RedisCacheWrapper redisCacheWrapper , VirtuosoAD virtuosoAD , IServicesUtilVirtuosoAndReplication servicesUtilVirtuosoAndReplication )
@@ -894,10 +810,10 @@ private void RefrescarCacheComponente(Guid pComponenteID, Guid pProyectoID, Enti
894810
895811 CMSComponente filaComponente = null ;
896812 CMSCN cmsCN = new CMSCN ( entityContext , loggingService , mConfigService , servicesUtilVirtuosoAndReplication ) ;
897- DataWrapperCMS cmsDW = cmsCN . ObtenerComponentePorID ( pComponenteID , pProyectoID ) ;
813+ DataWrapperCMS cmsDW = cmsCN . ObtenerComponentePorID ( pComponenteID , pProyectoID , false ) ;
898814 if ( cmsDW . ListaCMSComponente . Count > 0 )
899815 {
900- filaComponente = cmsCN . ObtenerComponentePorID ( pComponenteID , pProyectoID ) . ListaCMSComponente . FirstOrDefault ( ) ;
816+ filaComponente = cmsCN . ObtenerComponentePorID ( pComponenteID , pProyectoID , false ) . ListaCMSComponente . FirstOrDefault ( ) ;
901817 }
902818 cmsCN . Dispose ( ) ;
903819
@@ -937,7 +853,7 @@ private string ObtenerDominioComunidad(Guid pOrganizacionID, Guid pProyectoID, E
937853
938854 private string ObtenerURLRefrescoComponente ( CMSComponente pFilaComponente , EntityContext entityContext , LoggingService loggingService , IServicesUtilVirtuosoAndReplication servicesUtilVirtuosoAndReplication )
939855 {
940- return ObtenerDominioComunidad ( pFilaComponente . OrganizacionID , pFilaComponente . ProyectoID , entityContext , loggingService , servicesUtilVirtuosoAndReplication ) . TrimEnd ( '/' ) + " /cmspagina?proyectoid=" + pFilaComponente . ProyectoID + " &componenteid=" + pFilaComponente . ComponenteID ;
856+ return $ " { ObtenerDominioComunidad ( pFilaComponente . OrganizacionID , pFilaComponente . ProyectoID , entityContext , loggingService , servicesUtilVirtuosoAndReplication ) . TrimEnd ( '/' ) } /cmspagina?proyectoid={ pFilaComponente . ProyectoID } &componenteid={ pFilaComponente . ComponenteID } &refrescar=true" ;
941857 }
942858
943859 private void RealizarPeticionWebRefrescoCache ( CMSComponente pFilaComponente , EntityContext entityContext , LoggingService loggingService , RedisCacheWrapper redisCacheWrapper , IServicesUtilVirtuosoAndReplication servicesUtilVirtuosoAndReplication )
@@ -985,6 +901,7 @@ private void RealizarPeticionWebRefrescoCache(CMSComponente pFilaComponente, Ent
985901 realizarPeticion . PeticionesWebActuales = mPeticionesWebActuales ;
986902
987903 Task . Factory . StartNew ( realizarPeticion . EmpezarMantenimiento ) ;
904+ //Task.Factory.StartNew(realizarPeticion.RealizarMantenimiento(entityContext, null, null, loggingService, redisCacheWrapper, null, null, servicesUtilVirtuosoAndReplication));
988905
989906 Thread . Sleep ( 1000 ) ;
990907 }
0 commit comments