Giter Club home page Giter Club logo

Comments (8)

schroeder- avatar schroeder- commented on September 25, 2024 1

In asyncio you block the async loop until you call the next await. If you need to run code that doesn't call await for a while, there some solutions, like asyncio.to_thread for I/O bound or run_in_executor for cpu bound tasks.

from opcua-asyncio.

lkaupp avatar lkaupp commented on September 25, 2024

I also used the method self._client.get_node(), which is the same as my method implementation basically. However, still no events. What was altered during refactoring / rewriting the library to asyncio in the subscription process? Any ideas to debug the issue?

from opcua-asyncio.

schroeder- avatar schroeder- commented on September 25, 2024

Whats the code after your posted code? If you leave the with Statement the client will disconnect.

from opcua-asyncio.

lkaupp avatar lkaupp commented on September 25, 2024

Well here. Keep_running is true the whole time (same code as with freeopcua, which is working fine).:

            while self._keep_running:
                pass

            print("unsubscribe")
            await self._opcua_subscription.unsubscribe(self._opcua_handle)
            time.sleep(10)
            await self._opcua_subscription.delete()

Maybe next week I get the chance to capture a debug log. Which information do you need, and what commands should I use to get the necessary information?

from opcua-asyncio.

schroeder- avatar schroeder- commented on September 25, 2024

I think you need to give the asyncio some timeslot, also you are wasting cpu cycles. Try this:

while self._keep_running:
        await asyncio.sleep(1.0)

from opcua-asyncio.

lkaupp avatar lkaupp commented on September 25, 2024

Thanks for the tip. I will try your snippet as soon as I can enter the factory again.

from opcua-asyncio.

lkaupp avatar lkaupp commented on September 25, 2024

await asyncio.sleep(1.0)

you are officially my hero, never expected that a while pass loop prevents messages from being delivered. Is this asyncio related - do I prevent any internal loops?

from opcua-asyncio.

lkaupp avatar lkaupp commented on September 25, 2024

Thanks for the explanation. I close my issue and reference your answer in the discussion!

from opcua-asyncio.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.