neumino / rethinkdbdash

An advanced Node.js driver for RethinkDB with a connection pool, support for streams etc.
MIT License
848 stars 109 forks source link

Drain promise resolution #372

Closed cedbale closed 6 years ago

cedbale commented 6 years ago

Hello,

I would like to handle some post action after connection has been drain. After a look into the code, it seems that drain return a promise but i have difficulties to understand when the promise is resolved. By the way it seems that the promise is never resolved.

Is there a possibility to implement an async action like below ?

rdb.getPoolMaster()
        .drain()
        .then(() => {
            console.log('RDB drained');
        })
neumino commented 6 years ago

That should work as far as I know https://github.com/neumino/rethinkdbdash/blob/master/long_test/discovery.js#L407