mirror of
https://github.com/PRVTPRO/Amnezia-Web-Panel.git
synced 2026-10-23 03:37:36 +09:00
diag(awg): log clientsTable record count and External merge per read
Intermittent 'External instead of names' on NATA: response shows 13 named + 68 External peers. All read paths are all-or-error, so this logs container, path (prefetch batch vs direct) and record count to identify the wrong/partial read next time it happens.
This commit is contained in:
1 parent
25ae748a50
commit
39c155aa81
1 file changed
+17
@@ -2087,6 +2087,14 @@ x_exit_sync() {
|
||||
try:
|
||||
data = json.loads(out)
|
||||
if isinstance(data, list):
|
||||
# Diagnostics for the intermittent 'External instead of names'
|
||||
# glitch: log which container the table came from, via which
|
||||
# path, and how many records it held. When a response shows
|
||||
# N named + M External, this line tells whether the read
|
||||
# itself returned a wrong/partial table.
|
||||
logger.info(
|
||||
f"clientsTable {container_name}: {len(data)} records, "
|
||||
f"{len(out)} bytes (via {'prefetch batch' if batch is not None else 'direct read'})")
|
||||
return data
|
||||
elif isinstance(data, dict):
|
||||
# Migration from old format
|
||||
@@ -2098,6 +2106,9 @@ x_exit_sync() {
|
||||
'clientName': info.get('clientName', 'Unknown'),
|
||||
}
|
||||
})
|
||||
logger.info(
|
||||
f"clientsTable {container_name}: {len(result)} records "
|
||||
f"(legacy dict format, via {'prefetch batch' if batch is not None else 'direct read'})")
|
||||
return result
|
||||
except json.JSONDecodeError:
|
||||
if batch is not None:
|
||||
@@ -2557,6 +2568,7 @@ done < "$BW"
|
||||
client['userData'] = user_data
|
||||
|
||||
# Pick up peers from conf that are NOT in clientsTable (created via native Amnezia app)
|
||||
conf_peers = {}
|
||||
try:
|
||||
conf_peers = self._parse_peers_from_config(protocol_type)
|
||||
for pub_key, peer_info in conf_peers.items():
|
||||
@@ -2589,6 +2601,11 @@ done < "$BW"
|
||||
})
|
||||
except Exception as e:
|
||||
logger.warning(f'get_clients: failed to parse conf peers: {e}')
|
||||
external_added = sum(1 for c in clients_table if c.get('userData', {}).get('externalClient'))
|
||||
logger.info(
|
||||
f"get_clients({protocol_type}): table={len(known_ids)}, "
|
||||
f"conf peers total={len(conf_peers)}, "
|
||||
f"conf-only External appended={external_added}")
|
||||
|
||||
# Connection flood monitoring: attach the latest snapshot written by
|
||||
# the background collector (collect_conn_stats). Only if the snapshot
|
||||
|
||||
Reference in new issue
Block a user