Skip to content

Commit

Permalink
Increase Escrower tock to avoid overly busy CPU during escrow processing
Browse files Browse the repository at this point in the history
Setting tock to 1.0 second runs escrower loop 30s delay and delegator approval received after 30 seconds
  • Loading branch information
Rubel Hassan Mollik committed Jun 19, 2024
1 parent abf66f2 commit 7988c97
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
30 changes: 16 additions & 14 deletions src/keria/app/agenting.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"""
import json
import datetime
import os
from dataclasses import asdict
from urllib.parse import urlparse, urljoin
Expand Down Expand Up @@ -745,23 +746,24 @@ def __init__(self, kvy, rgy, rvy, tvy, exc, vry, registrar, credentialer):
self.vry = vry
self.registrar = registrar
self.credentialer = credentialer
self.tock = 1.0

super(Escrower, self).__init__()
super(Escrower, self).__init__(tock=self.tock)

def recur(self, tyme):
def recur(self, tyme=None):
""" Process all escrows once per loop. """
self.kvy.processEscrows()
self.kvy.processEscrowDelegables()
self.rgy.processEscrows()
self.rvy.processEscrowReply()
if self.tvy is not None:
self.tvy.processEscrows()
self.exc.processEscrow()
self.vry.processEscrows()
self.registrar.processEscrows()
self.credentialer.processEscrows()

return False
while True:
self.kvy.processEscrows()
self.kvy.processEscrowDelegables()
self.rgy.processEscrows()
self.rvy.processEscrowReply()
if self.tvy is not None:
self.tvy.processEscrows()
self.exc.processEscrow()
self.vry.processEscrows()
self.registrar.processEscrows()
self.credentialer.processEscrows()
yield self.tock


def loadEnds(app):
Expand Down
2 changes: 1 addition & 1 deletion tests/app/test_delegating.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def test_delegator_end(helpers):
assert res.status_code == 200
op = res.json
count += 1
if count > 10:
if count > 60:
raise Exception("Delegator never processed the delegatee dip event")

# Delegator escrows completed and now aknowledges the delegatee dip event
Expand Down

0 comments on commit 7988c97

Please sign in to comment.