test fix timestampt to capture time not db insert time
All checks were successful
Build and Deploy MITM Webserver / traffic_target (push) Successful in 0s
Build and Deploy MITM Webserver / build (push) Successful in 10s

This commit is contained in:
2026-03-09 14:33:43 +01:00
parent a49ee5b9bd
commit d2179b2813
4 changed files with 936 additions and 47 deletions

View File

@@ -156,6 +156,7 @@ class DatabasePool:
row = await conn.fetchrow(
"""
INSERT INTO packets (
timestamp,
correlation_key,
packet_id,
packet_uid,
@@ -197,11 +198,16 @@ class DatabasePool:
raw
) VALUES(
$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,
$21,$22,$23,$24,$25,$26,$27,$28,$29,$30,$31,$32,$33,$34,$35,$36::jsonb,
$37::jsonb,$38::jsonb,$39
$21,$22,$23,$24,$25,$26,$27,$28,$29,$30,$31,$32,$33,$34,$35,$36,$37::jsonb,
$38::jsonb,$39::jsonb,$40
)
ON CONFLICT (correlation_key) DO UPDATE SET
updated_at = NOW(),
timestamp = CASE
WHEN packets.timestamp IS NULL THEN EXCLUDED.timestamp
WHEN EXCLUDED.timestamp IS NULL THEN packets.timestamp
ELSE LEAST(packets.timestamp, EXCLUDED.timestamp)
END,
packet_id = COALESCE(EXCLUDED.packet_id, packets.packet_id),
packet_uid = COALESCE(EXCLUDED.packet_uid, packets.packet_uid),
correlation_source = COALESCE(EXCLUDED.correlation_source, packets.correlation_source),
@@ -250,6 +256,7 @@ class DatabasePool:
raw = COALESCE(EXCLUDED.raw, packets.raw)
RETURNING *
""",
pkt_info.get("timestamp"),
pkt_info["correlation_key"],
pkt_info.get("packet_id"),
pkt_info.get("packet_uid"),