From f25f5cd368563b16cc8446f3d1157d3e635ea68a Mon Sep 17 00:00:00 2001
From: Luke Parker <lukeparker5132@gmail.com>
Date: Thu, 12 Oct 2023 18:39:46 -0400
Subject: [PATCH] Add a sleep statement to Batch publication errors to prevent
 log flooding/node hammering

---
 coordinator/src/main.rs | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/coordinator/src/main.rs b/coordinator/src/main.rs
index 2132c56c..3a45a2f3 100644
--- a/coordinator/src/main.rs
+++ b/coordinator/src/main.rs
@@ -761,6 +761,8 @@ async fn handle_processor_messages<D: Db, Pro: Processors, P: P2p>(
                 );
                 // If we failed to publish it, restore it
                 batches.push_front(batch);
+                // Sleep for a few seconds before retrying to prevent hammering the node
+                tokio::time::sleep(Duration::from_secs(5)).await;
               }
             }