On 10/11/17 1:50 PM, Clinton D Skakun wrote:

void getUser(req, res) {
auto db = pool.lock()

db.query(...)

req.writeBody...
}

What happens when getUser is called but the request is cancelled halfway through before the query finishes?

Is there ever a time when the lock will never be released?

Unlikely. The lock is handled automatically via reference counting. So
the unlock will be done as the destructor for db is called exiting the
scope. This happens even if an exception is thrown.

-Steve