Skip to content

Commit 3f674ee

Browse files
authored
Merge pull request #11 from miohtama/feat/telegram-start-notification
Start notification for Telegram
2 parents 77bfa24 + cec73bb commit 3f674ee

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

main.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
InterruptHandler,
2929
check_default_account_balance,
3030
wait_prysm_ready,
31+
telegram,
3132
)
3233

3334
# Send notification to admins on error
@@ -63,11 +64,19 @@ def main() -> None:
6364
# wait for interrupt
6465
interrupt_handler = InterruptHandler()
6566

66-
# wait that node is synced before trying to do anything
67-
wait_prysm_ready(
68-
interrupt_handler, BEACON_CHAIN_RPC_ENDPOINT, PROCESS_INTERVAL, logger
67+
# Notify Telegram the oracle is warming up, so that
68+
# oracle maintainers know the service has restarted
69+
telegram.notify(
70+
message=f"Oracle starting with account [{web3_client.eth.defaultAccount}]"
71+
f"(https://etherscan.io/address/{web3_client.eth.defaultAccount})",
72+
parse_mode="markdown",
73+
raise_on_errors=True,
74+
disable_web_page_preview=True,
6975
)
7076

77+
# wait that node is synced before trying to do anything
78+
wait_prysm_ready(interrupt_handler, BEACON_CHAIN_RPC_ENDPOINT, PROCESS_INTERVAL)
79+
7180
reward_token_total_rewards = RewardToken(
7281
w3=web3_client, interrupt_handler=interrupt_handler
7382
)

src/utils.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from eth_typing.evm import HexAddress
1212
from google.protobuf import empty_pb2
1313
from grpc import insecure_channel, RpcError, StatusCode
14-
from loguru import logger, Logger
14+
from loguru import logger
1515
from notifiers.core import get_notifier # type: ignore
1616
from web3 import Web3
1717
from web3.contract import Contract
@@ -206,7 +206,6 @@ def wait_prysm_ready(
206206
interrupt_handler: InterruptHandler,
207207
endpoint: str,
208208
process_interval: int,
209-
logger: Logger,
210209
) -> None:
211210
"""Wait that Prysm accepts requests and is synced.
212211

0 commit comments

Comments
 (0)