sofastack/sofa-rpc-node

how to re-publish after reconnected to the zookeeper ?

wziww opened this issue · 3 comments

wziww commented

After the connection expired , it will auto reconnect , but how can we re-publish the provider ?
is there any way to do sth like this :

server.start()
    .then(async () => {
        server.publish();
        server.on('server:event', async (e) => {
            if (e.type === 'zookeeper' && e.name === 'connected') {
                server.services.get(e.id).rePublish();
            }
        });
    });

i think zk registry will re-publish automatically, if not i think it's a bug

i will add testcase for connection expired

i's a bug 🐛