mirror of
https://github.com/launchbadge/sqlx.git
synced 2025-12-29 21:00:54 +00:00
Once a connection to the database is lost all future macro evaluations will fail. This is fine for normal compilation since it tends to be short but causes issues with rust-analyzer since it keeps the macro binaries loaded for a long time. This commit changes the macro implementation to drop the cached connection when it encounters an IO or protocol error. In practice these seem to be the errors that show up when the connection is lost and dumping the connection on every error would have unnecessary overhead.