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

failed to mpub (192.168.1.199:4150, ['123']), data is SendError: no open connections (None) #262

Open
ghost opened this issue Mar 15, 2022 · 4 comments

Comments

@ghost
Copy link

ghost commented Mar 15, 2022

No description provided.

@outman
Copy link

outman commented Apr 11, 2022

Without ioloop context

def publish(t: str, m: bytes):

    def producer(topic, message, callback=None):
        if not writer.conns:
            return writer.io_loop.add_callback(
                partial(producer, *(topic, message, callback))
            )
        writer.pub(topic, message, callback)

    def on_finish(conn, status_code):
        logger.info('publish_result:{},{}'.format(conn, status_code))
        io_loop.stop()

    writer = nsq.Writer(os.getenv('NSQ_NSQD_TCP_ADDRESS', '').split(','))
    io_loop = tornado.ioloop.IOLoop.instance()
    writer.io_loop.add_callback(
        partial(producer, *(t, m, on_finish))
    )
    io_loop.start()

With ioloop consumer context

def publish(t: str, m: bytes):

    def producer(topic, message, callback=None):
        if not writer.conns:
            return writer.io_loop.add_callback(
                partial(producer, *(topic, message, callback))
            )
        writer.pub(topic, message, callback)

    def on_finish(conn, status_code):
        logger.info('publish_result:{},{}'.format(conn, status_code))
        # io_loop.stop()

    writer = nsq.Writer(os.getenv('NSQ_NSQD_TCP_ADDRESS', '').split(','))
    # io_loop = tornado.ioloop.IOLoop.instance()
    writer.io_loop.add_callback(
        partial(producer, *(t, m, on_finish))
    )
    # io_loop.start()

@outman
Copy link

outman commented Mar 21, 2024

@aviezab
I'm very sorry, the code involved in that issue is too old and can no longer be found. If the message has been published successfully, you can check through the nsq management interface to see if the message is normal.

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

2 participants
@outman and others