Skip to content

Commit

Permalink
fix: backoff 1 minute after unsuccessful finalization attempts (#231)
Browse files Browse the repository at this point in the history
fix: backoff 15 seconds after unsuccessful finalization attempts
  • Loading branch information
montekki authored Oct 13, 2023
1 parent ea07a58 commit 3fb7e3c
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 17 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE finalization_data DROP COLUMN last_finalization_attempt;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE finalization_data ADD last_finalization_attempt TIMESTAMP;
6 changes: 6 additions & 0 deletions storage/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,11 @@ pub async fn withdrwals_to_finalize(pool: &PgPool, limit_by: u64) -> Result<Vec<
),
1
)
AND (
last_finalization_attempt IS NULL
OR
last_finalization_attempt < NOW() - INTERVAL '1 minutes'
)
ORDER BY
finalization_data.l2_block_number
LIMIT
Expand Down Expand Up @@ -843,6 +848,7 @@ pub async fn inc_unsuccessful_finalization_attempts(
UPDATE
finalization_data
SET
last_finalization_attempt = NOW(),
failed_finalization_attempts = failed_finalization_attempts + 1
FROM
(
Expand Down

0 comments on commit 3fb7e3c

Please sign in to comment.