Skip to content

Commit ed0e939

Browse files
Reset the tic counter after sending a proof
1 parent 1037d7f commit ed0e939

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

alerts/periodic_sender.sh

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ function fetch_gas_price() {
1818

1919
source "$ENV_FILE"
2020

21-
# Each tic lasts for 30 minutes
22-
sleep_time=1800
21+
# Each tic lasts for 30 seconds
22+
sleep_time=30
2323
tic=0
2424

2525
while true; do
@@ -33,28 +33,29 @@ while true; do
3333
# - Between 10 and 14 tics (5 to 7 hours), if gas price is below 2 gwei, send a proof
3434
message="Sending proof at tic $tic with gas price $current_gas_price wei"
3535
echo "$message"
36-
./sender_with_alert.sh "$ENV_FILE"
36+
./alerts/sender_with_alert.sh "$ENV_FILE"
37+
tic=0 # Reset tic counter after sending a proof
3738
elif { [ $tic -ge 14 ] && [ $tic -lt 16 ] && [ $current_gas_price -lt 5000000000 ]; }; then
3839
# - Between 14 and 16 tics (7 to 8 hours), if gas price is below 5 gwei, send a proof
3940
message="Sending proof at tic $tic with gas price $current_gas_price wei"
4041
echo "$message"
41-
./sender_with_alert.sh "$ENV_FILE"
42+
./alerts/sender_with_alert.sh "$ENV_FILE"
43+
tic=0 # Reset tic counter after sending a proof
4244
elif { [ $tic -ge 16 ] && [ $tic -lt 24 ] && [ $current_gas_price -lt 15000000000 ]; }; then
4345
# - Between 16 and 24 tics (8 to 12 hours), if gas price is below 15 gwei, send a proof
4446
message="Sending proof at tic $tic with gas price $current_gas_price wei"
4547
echo "$message"
46-
./sender_with_alert.sh "$ENV_FILE"
48+
./alerts/sender_with_alert.sh "$ENV_FILE"
49+
tic=0 # Reset tic counter after sending a proof
4750
elif { [ $tic -ge 50 ] && [ $current_gas_price -lt 50000000000 ]; }; then
4851
# - After 50 tics (25 hours), if gas price is below 50 gwei, send a proof
4952
message="Sending proof at tic $tic with gas price $current_gas_price wei"
5053
echo "$message"
51-
./sender_with_alert.sh "$ENV_FILE"
54+
./alerts/sender_with_alert.sh "$ENV_FILE"
55+
tic=0 # Reset tic counter after sending a proof
5256
fi
5357

5458
tic=$((tic + 1))
55-
if [ $tic -ge 96 ]; then
56-
tic=0
57-
fi
5859

5960
echo "Sleeping $sleep_time seconds (($((sleep_time / 60)) minutes))"
6061
sleep "$sleep_time"

0 commit comments

Comments
 (0)