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

Solve holding tier issue for instances #523

Merged
merged 1 commit into from
Feb 1, 2024
Merged
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
28 changes: 14 additions & 14 deletions src/aleph/vm/orchestrator/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,20 +147,20 @@ async def monitor_payments(app: web.Application):
while True:
await asyncio.sleep(settings.PAYMENT_MONITOR_INTERVAL)

# Check if the balance held in the wallet is sufficient holder tier resources
for sender, chains in pool.get_executions_by_sender(payment_type=PaymentType.hold).items():
for chain, executions in chains.items():
balance = await fetch_balance_of_address(sender)

# Stop executions until the required balance is reached
required_balance = await compute_required_balance(executions)
logger.debug(f"Required balance for Sender {sender} executions: {required_balance}")
# Stop executions until the required balance is reached
while balance < (required_balance + settings.PAYMENT_BUFFER):
last_execution = executions.pop(-1)
logger.debug(f"Stopping {last_execution} due to insufficient stream")
await pool.stop_vm(last_execution.vm_hash)
required_balance = await compute_required_balance(executions)
# Check if the balance held in the wallet is sufficient holder tier resources (Not do it yet)
# for sender, chains in pool.get_executions_by_sender(payment_type=PaymentType.hold).items():
# for chain, executions in chains.items():
# balance = await fetch_balance_of_address(sender)
#
# # Stop executions until the required balance is reached
# required_balance = await compute_required_balance(executions)
# logger.debug(f"Required balance for Sender {sender} executions: {required_balance}")
# # Stop executions until the required balance is reached
# while balance < (required_balance + settings.PAYMENT_BUFFER):
# last_execution = executions.pop(-1)
# logger.debug(f"Stopping {last_execution} due to insufficient balance")
# await pool.stop_vm(last_execution.vm_hash)
# required_balance = await compute_required_balance(executions)
hoh marked this conversation as resolved.
Show resolved Hide resolved

# Check if the balance held in the wallet is sufficient stream tier resources
for sender, chains in pool.get_executions_by_sender(payment_type=PaymentType.superfluid).items():
Expand Down
Loading