Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/240605 #68

Merged
merged 2 commits into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "witnet-price-feeds-poller",
"version": "2.2.1",
"version": "2.2.2",
"description": "",
"main": "",
"repository": "https://github.com/witnet/witnet-price-feeds-poller/tree/2.2.x",
Expand Down
16 changes: 11 additions & 5 deletions price_feeds_poller.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import contextlib
import datetime
import os
import re
import math
import subprocess
import sys
import time
Expand Down Expand Up @@ -313,11 +313,17 @@ def handle_loop(
if time_left_secs <= 86400 * 3 and timer_out:
# start warning every 900 seconds if estimated time before draining funds is less than 3 days
low_balance_ts = loop_ts
print(f"LOW FUNDS !!!: estimated {round(time_left_secs / 3600, 2)} hours before running out of funds")
else:
print(f"Time-To-Die: {round(time_left_secs / 3600, 2)} hours")
time_left_hours = time_left_secs / 3600
if time_left_hours < 1:
print("LOW FUNDS !!!: estimated less than 1 hour before running out of funds")
elif time_left_hours < 10:
estimate = math.floor(time_left_hours)
print(f"LOW FUNDS !!!: estimated less than {estimate} hours before running out of funds")
else:
estimate = math.ceil(time_left_hours / 10) * 10
print(f"LOW FUNDS !!!: estimated less than {estimate} hours before running out of funds")

# On every iteration, read latest prices of all currently supported pfs
# On every iteration, read latest prices of all currently supported pfs
latest_prices = feeds.functions.latestPrices(ids).call()

except Exception as ex:
Expand Down
Loading