Merge pull request #174 from flashbots/listener-lag-fix

Fix listener first startup
This commit is contained in:
Luke Van Seters 2021-12-20 12:54:32 -05:00 committed by GitHub
commit 82c167d842
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 6 deletions

View File

@ -23,6 +23,7 @@ case "$1" in
stop)
echo -n "Stopping daemon: "$NAME
start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE
rm $PIDFILE
echo "."
;;
tail)
@ -31,6 +32,7 @@ case "$1" in
restart)
echo -n "Restarting daemon: "$NAME
start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile $PIDFILE
rm $PIDFILE
start-stop-daemon \
--background \
--chdir /app \

View File

@ -65,14 +65,10 @@ async def inspect_next_block(
if last_written_block is None:
# maintain lag if no blocks written yet
last_written_block = latest_block_number - 1
last_written_block = latest_block_number - BLOCK_NUMBER_LAG - 1
if last_written_block < (latest_block_number - BLOCK_NUMBER_LAG):
block_number = (
latest_block_number
if last_written_block is None
else last_written_block + 1
)
block_number = last_written_block + 1
logger.info(f"Writing block: {block_number}")