GithubHelp home page GithubHelp logo

Comments (2)

igorcoding avatar igorcoding commented on May 27, 2024

Thank you for the report, but it's actually an intended behaviour. The main idea is that it's better to fail if connection is lost than hang the request trying to connect indefinitely to Tarantool. Take a look at the following script:

import asyncio
import asynctnt
import asynctnt.exceptions
import uvloop
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())


async def run():
    c = asynctnt.Connection(host='localhost', port=33301)
    await c.connect()
    while 1:
        try:
            print(await c.call('box.info'))   # <-- Tarantool instance goes down here
        except asynctnt.exceptions.TarantoolNotConnectedError:
            print('lost connection')
        await asyncio.sleep(1)


loop = asyncio.get_event_loop()
try:
    loop.run_until_complete(run())
except KeyboardInterrupt:
    loop.stop()
    loop.close()

If you run it you will see messages like

Connect to Tarantool[localhost:33301] failed: ConnectionRefusedError(111, 'Connection refused'). Retrying in 0.333333 seconds

as asynctnt will try to reconnect to Tarntool in the background.And finally when you start Tarantool instance back it will continue to successfully execute call statements.

from asynctnt.

bofm avatar bofm commented on May 27, 2024

I get it. Sorry for bothering.

from asynctnt.

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.