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

Strange behaviour (or me not properly understanding asyncio and aiozmq) - Code only sends when publish more than once #188

Open
marek-j opened this issue Feb 26, 2023 · 1 comment

Comments

@marek-j
Copy link

marek-j commented Feb 26, 2023

The publish is only send (or received) when max > 1, but then it only sends one less time than asked to run.

 async def go():
     tb = await rpc.connect_pubsub(connect="tcp://localhost:5501")
     max = 2
     idx = 0
     while True:
        print("sleeping ")
        if idx < max:
            tb.publish("botupdates").message("Test")           
        await asyncio.sleep(4)
        idx = idx +1 
         
 
 asyncio.run(go())
@marek-j
Copy link
Author

marek-j commented Feb 26, 2023

I go to the above example because this trivial example did not work:

 async def go():
     tb = await rpc.connect_pubsub(connect="tcp://localhost:5501")
     tb.publish("botupdates").message("Test")           
     while True:
        await asyncio.sleep(4)
        
 
 asyncio.run(go())

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant