mirror of
https://github.com/safing/portmaster.git
synced 2026-12-04 09:38:21 +00:00
7dd9e195b5
main.bandwidth declares ON DELETE CASCADE on conn_id, but foreign keys are never enabled on the connection, so the cascade never runs. Cleanup deleted the connections and left their bandwidth rows behind: one row per connection per second of traffic, kept in memory for the whole uptime of the process. Delete the bandwidth rows of the connections that Cleanup is about to remove, before removing them, and index conn_id, which the bandwidth chart joins on and the cleanup deletes through. The delete is limited to the connections being removed, so its cost does not grow with the rows of live connections, and a bandwidth update that arrives before its connection is saved is left alone. Add a test for the cleanup and the index.