Skip to content

Commit

Permalink
Merge pull request #457 from google/gbg/bench-ascyncio-main
Browse files Browse the repository at this point in the history
delay creation of runner object
  • Loading branch information
barbibulle authored Apr 3, 2024
2 parents e21d122 + 76bca03 commit e6913a3
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions apps/bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -1234,6 +1234,7 @@ async def run(self):
'cyan',
)
)

await self.connected.wait()
logging.info(color('### Connected', 'cyan'))

Expand Down Expand Up @@ -1593,8 +1594,8 @@ def central(
mode_factory = create_mode_factory(ctx, 'gatt-client')
classic = ctx.obj['classic']

asyncio.run(
Central(
async def run_central():
await Central(
transport,
peripheral_address,
classic,
Expand All @@ -1606,7 +1607,8 @@ def central(
encrypt or authenticate,
ctx.obj['extended_data_length'],
).run()
)

asyncio.run(run_central())


@bench.command()
Expand All @@ -1617,15 +1619,16 @@ def peripheral(ctx, transport):
role_factory = create_role_factory(ctx, 'receiver')
mode_factory = create_mode_factory(ctx, 'gatt-server')

asyncio.run(
Peripheral(
async def run_peripheral():
await Peripheral(
transport,
ctx.obj['classic'],
ctx.obj['extended_data_length'],
role_factory,
mode_factory,
).run()
)

asyncio.run(run_peripheral())


def main():
Expand Down

0 comments on commit e6913a3

Please sign in to comment.