Skip to content

Commit a9d1b5e

Browse files
authored
Merge pull request #3436 from johannaengland/cleanup/navoidverify-inlinecallbacks
Replace inlineCallbacks with coroutines in `navoidverify.py`
2 parents d7ef7c3 + 358d649 commit a9d1b5e

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

python/nav/bin/navoidverify.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,13 @@ def reactor_main(boxes, baseoid):
6666
return df.addCallback(endit)
6767

6868

69-
@defer.inlineCallbacks
70-
def verify(netbox, oid):
69+
async def verify(netbox, oid):
7170
"""Verifies a GETNEXT response from below the oid subtree"""
7271
agent = _create_agentproxy(netbox)
7372
if not agent:
7473
return False
7574

76-
result = yield agent.walk(str(oid))
75+
result = await agent.walk(str(oid))
7776
agent.close()
7877

7978
if hasattr(result, 'items'):
@@ -113,7 +112,7 @@ def parse_args():
113112
def parallel(iterable, count, func, *args, **kwargs):
114113
"""Limits the number of parallel requests to count"""
115114
coop = task.Cooperator()
116-
work = (func(elem, *args, **kwargs) for elem in iterable)
115+
work = (defer.ensureDeferred(func(elem, *args, **kwargs)) for elem in iterable)
117116
return defer.DeferredList(
118117
[coop.coiterate(work) for _ in range(count)], consumeErrors=True
119118
)

0 commit comments

Comments
 (0)