From 15ab4d02d58f74e15ca8e1d0228cb61f6c990014 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Ludwig?= Date: Thu, 28 Mar 2019 13:34:30 +0100 Subject: [PATCH] Add MongoClient.cleanupConnections. Disconnects any unused connections to the server. --- mongodb/vibe/db/mongo/client.d | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/mongodb/vibe/db/mongo/client.d b/mongodb/vibe/db/mongo/client.d index 646d9fe662..761ce4332d 100644 --- a/mongodb/vibe/db/mongo/client.d +++ b/mongodb/vibe/db/mongo/client.d @@ -85,6 +85,15 @@ final class MongoClient { lockConnection(); } + /** Disconnects all currently unused connections to the server. + */ + void cleanupConnections() + { + m_connections.removeUnused((conn) { + conn.disconnect(); + }); + } + /** Accesses a collection using an absolute path.