From d201a800686b6d79e1f023920ee5d4f9d3f5da5c Mon Sep 17 00:00:00 2001 From: Dave Jones Date: Tue, 29 Nov 2022 16:43:31 -0600 Subject: [PATCH] v0.2.1-rc3 - release --- docker/docker-compose.yaml | 2 +- podping/dbif/src/lib.rs | 3 ++- podping/src/main.rs | 16 +++++++++++----- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/docker/docker-compose.yaml b/docker/docker-compose.yaml index 9b8a495..25d62e9 100644 --- a/docker/docker-compose.yaml +++ b/docker/docker-compose.yaml @@ -18,7 +18,7 @@ services: ipv4_address: 192.168.69.68 hive-writer: - image: docker.io/podcastindexorg/podping-hivewriter:pr-67 + image: docker.io/podcastindexorg/podping-hivewriter:develop command: ["server"] init: true restart: unless-stopped diff --git a/podping/dbif/src/lib.rs b/podping/dbif/src/lib.rs index d247446..531acc4 100644 --- a/podping/dbif/src/lib.rs +++ b/podping/dbif/src/lib.rs @@ -354,7 +354,8 @@ pub fn reset_pings_in_flight() -> Result> { SET inflight = 0, \ createdon = STRFTIME('%s') \ WHERE inflight = 1 \ - AND createdon < (STRFTIME('%s') - 180)", + AND createdon < (STRFTIME('%s') - 180)\ + LIMIT 25", params![]) { Ok(_) => { diff --git a/podping/src/main.rs b/podping/src/main.rs index bc879a0..0247869 100644 --- a/podping/src/main.rs +++ b/podping/src/main.rs @@ -167,11 +167,6 @@ async fn main() { Err(_) => eprintln!("SystemTime before UNIX EPOCH!"), } - //Reset old inflight pings that may have never been sent - if dbif::reset_pings_in_flight().is_err() { - eprintln!(" Failed to reset old in-flight pings."); - } - //We always want to try and receive any waiting socket messages before moving on to sending receive_messages(&requester); @@ -301,9 +296,20 @@ async fn main() { } } + //Only sleep to avoid a hard loop in the case that there aren't enough + //recv() timeouts happening to simulate decent slowness if sent < 5 { thread::sleep(Duration::from_millis(LOOP_TIMER_MILLISECONDS)); } + + //Reset old inflight pings that may have never been sent, but only do this + //when things are not super busy since that is a sign that the writer may + //be full up and we need to allow more time + if sent < 25 { + if dbif::reset_pings_in_flight().is_err() { + eprintln!(" Failed to reset old in-flight pings."); + } + } } });