mirror of
https://github.com/dgtlmoon/changedetection.io.git
synced 2026-07-08 16:32:00 +00:00
Checking now relatime
This commit is contained in:
@@ -7,6 +7,7 @@ from flask_babel import gettext as _
|
||||
|
||||
from changedetectionio import forms
|
||||
from changedetectionio import processors
|
||||
from changedetectionio import worker_pool
|
||||
from changedetectionio.store import ChangeDetectionStore
|
||||
from changedetectionio.auth_decorator import login_optionally_required
|
||||
|
||||
@@ -96,6 +97,7 @@ def construct_blueprint(datastore: ChangeDetectionStore, update_q, queuedWatchMe
|
||||
active_tag=active_tag,
|
||||
active_tag_uuid=active_tag_uuid,
|
||||
active_processor=active_processor,
|
||||
checking_now_size=len(worker_pool.get_running_uuids()),
|
||||
app_rss_token=datastore.data['settings']['application'].get('rss_access_token'),
|
||||
datastore=datastore,
|
||||
errored_count=errored_count,
|
||||
|
||||
@@ -192,6 +192,13 @@ def handle_watch_update(socketio, **kwargs):
|
||||
socketio.emit("watch_update", {'watch': watch_data})
|
||||
socketio.emit("general_stats_update", general_stats)
|
||||
|
||||
# The set of running UUIDs changes exactly when a worker claims/releases a watch,
|
||||
# and this signal fires at both of those moments - so emit the live "checking now" count here.
|
||||
socketio.emit("checking_now", {
|
||||
"count": len(running_uuids),
|
||||
"event_timestamp": time.time()
|
||||
})
|
||||
|
||||
# Log after successful emit - use watch_data['uuid'] to avoid variable shadowing issues
|
||||
logger.trace(f"Socket.IO: Emitted update for watch {watch_data['uuid']}, Checking now: {watch_data['checking_now']}")
|
||||
|
||||
@@ -311,6 +318,7 @@ def init_socketio(app, datastore):
|
||||
from flask import request
|
||||
from flask_login import current_user
|
||||
from changedetectionio.flask_app import update_q
|
||||
from changedetectionio import worker_pool
|
||||
|
||||
# Access datastore from socketio
|
||||
datastore = socketio.datastore
|
||||
@@ -331,6 +339,14 @@ def init_socketio(app, datastore):
|
||||
"event_timestamp": time.time()
|
||||
}, room=request.sid) # Send only to this client
|
||||
logger.debug(f"Socket.IO: Sent initial queue size {queue_size} to new client")
|
||||
|
||||
# Send the current "checking now" count (how many watches workers are processing right now)
|
||||
checking_now = len(worker_pool.get_running_uuids())
|
||||
socketio.emit("checking_now", {
|
||||
"count": checking_now,
|
||||
"event_timestamp": time.time()
|
||||
}, room=request.sid) # Send only to this client
|
||||
logger.debug(f"Socket.IO: Sent initial checking_now {checking_now} to new client")
|
||||
except Exception as e:
|
||||
logger.error(f"Socket.IO error sending initial queue size: {str(e)}")
|
||||
|
||||
|
||||
@@ -79,6 +79,8 @@ $(document).ready(function () {
|
||||
// BOTH the desktop sidebar and the hamburger drawer — keep them in sync.
|
||||
const queueBubble = document.getElementById('queue-bubble');
|
||||
const queueSizeNodes = document.querySelectorAll('.queue-size-int');
|
||||
// "Checking now" count - rendered in both the desktop sidebar and the hamburger drawer.
|
||||
const checkingNowNodes = document.querySelectorAll('.checking-now-int');
|
||||
// Only try to connect if authentication isn't required or user is authenticated
|
||||
// The 'is_authenticated' variable will be set in the template
|
||||
if (typeof is_authenticated !== 'undefined' ? is_authenticated : true) {
|
||||
@@ -172,6 +174,13 @@ $(document).ready(function () {
|
||||
}
|
||||
})
|
||||
|
||||
socket.on('checking_now', function (data) {
|
||||
console.log(`${data.event_timestamp} - Checking now update: ${data.count}`);
|
||||
const formattedCount = parseInt(data.count).toLocaleString() || 'None';
|
||||
checkingNowNodes.forEach(node => { node.textContent = formattedCount; });
|
||||
document.body.classList.toggle('is-checking-now', parseInt(data.count) > 0);
|
||||
})
|
||||
|
||||
// Listen for operation results
|
||||
socket.on('operation_result', function (data) {
|
||||
if (data.success) {
|
||||
|
||||
@@ -173,4 +173,15 @@ $watch-table-mobile-max: 767px;
|
||||
.watch-table thead tr th .hide-on-desktop {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@media (min-width: 1600px) {
|
||||
.watch-table {
|
||||
td.last-checked, td.last-changed {
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -120,12 +120,13 @@
|
||||
</a>
|
||||
</li>
|
||||
<li class="action-sidebar-divider" aria-hidden="true"></li>
|
||||
<li>
|
||||
|
||||
<div class="action-sidebar-li" id="queue-stats-sidebar">
|
||||
|
||||
<li class="action-sidebar-li" id="checking-now-stats-sidebar">
|
||||
{{ _('Checking now') }}: <span class="checking-now-int">{{ checking_now_size }}</span>
|
||||
</li>
|
||||
<li class="action-sidebar-li" id="queue-stats-sidebar">
|
||||
{{ _('In queue') }}: <span class="queue-size-int">{{ queue_size }}</span>
|
||||
</div>
|
||||
|
||||
</li>
|
||||
<li class="action-sidebar-li">
|
||||
{% if hosted_sticky %}
|
||||
|
||||
Reference in New Issue
Block a user