File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed
Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ NETWORK=<NETWORK>
3333PRIVATE_KEY = <SENDER_PRIVATE_KEY>
3434VERIFICATION_WAIT_TIME = <TIME_TO_WAIT_FOR_VERIFICATION>
3535LOGS_BLOCK_RANGE = <LOGS_BLOCK_RANGE>
36+ BATCHER_METRICS_URL = <BATCHER_METRICS_URL>
3637
3738# Variables for aggregation_mode_alerts.sh
3839CONTRACT_ADDRESS = <YOUR_CONTRACT_ADDRESS>
Original file line number Diff line number Diff line change @@ -25,6 +25,12 @@ function fetch_gas_price() {
2525 echo $gas_price
2626}
2727
28+ # Get batcher queue len
29+ function get_queue_length() {
30+ queue_len=$( curl $BATCHER_METRICS_URL -s | grep queue_len | awk ' {print $2}' | tail -n 1)
31+ echo $queue_len
32+ }
33+
2834source " $ENV_FILE "
2935
3036# Each elapsed interval lasts for 5 minutes
@@ -48,6 +54,14 @@ while true; do
4854 fi
4955 echo " Current gas price: $current_gas_price wei"
5056
57+ queue_len=$( get_queue_length)
58+ if [ " $queue_len " -eq 0 ]; then
59+ echo " There are no pending proofs in the queue, skipping this pass."
60+ echo " Sleeping $sleep_time seconds (($(( sleep_time / 60 )) minutes))"
61+ sleep " $sleep_time "
62+ continue
63+ fi
64+
5165 # In case current and gas price meet the criteria, send a proof and reset counter
5266 if { [ $elapsed_intervals -ge 1 ] && [ $elapsed_intervals -lt 3 ] && [ $current_gas_price -lt 1500000000 ]; }; then
5367 # Between 1 and 3 elapsed intervals (5 to 15 minutes), if gas price is below 1.5 gwei, send a proof
You can’t perform that action at this time.
0 commit comments