Fix DNS seed dump flushing
Summary:
D10666 introduced a regression where the UninterruptibleSleep() call at the end of the loop may stall flushing of the DNS dump files until the sleep has completed. This results in long periods where some contents have been written to the files but not all. Example last line of the dump file snapshotted on some days:
==> /var/ecash-seeders/mainnet/dnsseed-2024-03-05.dump <== 158.69.24.50:8336 0 1590017628 ==> /var/ecash-seeders/mainnet/dnsseed-2024-03-06.dump <== 203.134.96.84:8333 0 1578195195 6.44% 2.92% 1.11% 0.17% 0.04% 616413 00000424 70015 "/Bitcoin ABC:0.20.6(EB32.0)/ ==> /var/ecash-seeders/mainnet/dnsseed-2024-03-07.dump <== 203.134.100.63:8333 0 1575572289 6.52% 2.99% 1.14% 0.17% 0.04 ==> /var/ecash-seeders/mainnet/dnsseed.dump <== 188.234.101.27:8333 0
Test Plan:
ninja bitcoin-seeder check-seeder ./src/seeder/bitcoin-seeder -host=seeder.status.cash -ns=localhost -mbox=thonkle@protonmail.com -port=5555 -dumpinterval=1
Over a few minutes, observe the end of the dump file:
while true ; do clear ; tail src/seeder/dnsseed.dump ; sleep 1 ; done
There should be no truncation on the last line with patch applied.
Reviewers: O1 Bitcoin ABC, #bitcoin_abc, Fabien
Reviewed By: O1 Bitcoin ABC, #bitcoin_abc, Fabien
Subscribers: Fabien
Differential Revision: https://reviews.bitcoinabc.org/D15666