Skip to content

Commit 6c51a01

Browse files
committed
fix bug cache page
1 parent d243f24 commit 6c51a01

File tree

5 files changed

+5
-14
lines changed

5 files changed

+5
-14
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ instance/*
44
.webassets-cache
55
.env
66
*.db
7+
*.db-journal
78

89
### Python template
910
# Byte-compiled / optimized / DLL files

app.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ def index():
5353

5454
@app.route('/actualizar-conexiones')
5555
def actualizar_conexiones():
56-
"""Retorna solo el HTML parcial de las conexiones por usuario"""
5756
try:
5857
raw_data = fetch_squid_data()
5958
if 'Error' in raw_data:
@@ -62,8 +61,6 @@ def actualizar_conexiones():
6261

6362
connections = parse_raw_data(raw_data)
6463
grouped_connections = group_by_user(connections)
65-
66-
# Renderiza solo el fragmento parcial que actualizarás con JS
6764
return render_template('partials/conexiones.html', grouped_connections=grouped_connections)
6865

6966
except Exception as e:
@@ -80,8 +77,7 @@ def cache_stats():
8077
data = fetch_squid_cache_stats()
8178
stats_data = vars(data) if hasattr(data, '__dict__') else data
8279
logger.info("Successfully fetched cache statistics")
83-
return render_template('cacheView.html', cache_stats=stats_data,
84-
refresh_interval=refresh_interval)
80+
return render_template('cacheView.html', cache_stats=stats_data)
8581

8682
except Exception as e:
8783
logger.error(f"Error fetching cache stats: {str(e)}")
@@ -98,7 +94,7 @@ def logs():
9894
print(f"Error en ruta /logs: {e}")
9995
return render_template('error.html', message="Error retrieving logs"), 500
10096

101-
@scheduler.task('interval', id='do_job_1', seconds=120, misfire_grace_time=900)
97+
@scheduler.task('interval', id='do_job_1', seconds=30, misfire_grace_time=900)
10298
def init_scheduler():
10399
"""Initialize and start the background scheduler for log processing"""
104100
log_file = os.getenv("SQUID_LOG", "/var/log/squid/access.log")

templates/components/cache_stats.html

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
<meta http-equiv="refresh" content="{{ refresh_interval }}">
2-
31
<section class="cache-stats">
42
<h2><i class="fas fa-server"></i> Estadísticas de Caché</h2>
53
<div class="stats-container">
@@ -43,7 +41,6 @@ <h3>Edad LRU</h3>
4341
</div>
4442
</div>
4543

46-
<!-- Leyenda explicativa -->
4744
<div class="cache-legend">
4845
<h3><i class="fas fa-info-circle"></i> Información sobre las métricas</h3>
4946
<p><strong>Entradas almacenadas:</strong> Número de objetos actualmente en la caché de Squid.</p>

templates/error.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44
<meta charset="UTF-8">
55
<meta name="viewport" content="width=device-width, initial-scale=1.0">
66
<title>Error - Squid Monitor</title>
7-
<!-- Bootstrap CSS para un estilo profesional -->
87
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
9-
<!-- Estilos personalizados -->
108
<style>
119
body {
1210
background-color: #f8f9fa;
@@ -40,7 +38,7 @@
4038
<body>
4139
<div class="error-container">
4240
<div class="error-icon">
43-
<i class="bi bi-exclamation-triangle-fill"></i> <!-- Icono de error -->
41+
<i class="bi bi-exclamation-triangle-fill"></i>
4442
</div>
4543
<h1 class="error-message">{{ message }}</h1>
4644
<p>Disculpamos las molestias. Por favor, intenta de nuevo más tarde o contacta al soporte si el problema persiste.</p>

templates/index.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,9 @@ <h1><i class="fas fa-server"></i> Estadísticas de Squid</h1>
2121
}
2222
}
2323

24-
// Llama a la función cada 15 segundos
24+
// Call Function 15 seconds
2525
setInterval(refrescarConexiones, 15000);
2626

27-
// También actualiza al cargar la página
2827
window.onload = refrescarConexiones;
2928
</script>
3029
{% endblock %}

0 commit comments

Comments
 (0)