Skip to content

Commit

Permalink
force update
Browse files Browse the repository at this point in the history
  • Loading branch information
cryptobench committed May 31, 2024
1 parent d69e634 commit b1bc28b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions stats-backend/api2/scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,14 +169,14 @@ def update_providers_info(node_props):
@app.task
def update_nodes_status(nodes_to_update):
for provider_id, is_online_now in nodes_to_update.items():

provider, created = Node.objects.get_or_create(node_id=provider_id)
# Get the latest status from Redis
latest_status = r.get(f"node_status:{provider_id}")

if latest_status is None:
print(f"Status not found in Redis for provider {provider_id}")
# Status not found in Redis, fetch the latest status from the database
provider, created = Node.objects.get_or_create(node_id=provider_id)

latest_status_subquery = (
NodeStatusHistory.objects.filter(provider=provider)
.order_by("-timestamp")
Expand Down Expand Up @@ -221,6 +221,8 @@ def update_nodes_status(nodes_to_update):

# Update the status in Redis
r.set(f"node_status:{provider_id}", str(is_online_now))
provider.online = is_online_now
provider.save()

from celery import group

Expand Down

0 comments on commit b1bc28b

Please sign in to comment.