@@ -21,40 +21,30 @@ TreeOperations::TreeOperations(
21
21
22
22
bool TreeOperations::loadDatabases (
23
23
std::function<void (RedisClient::DatabaseList)> callback) {
24
- bool connected = m_connection->isConnected ();
25
-
26
- if (connected) {
27
- try {
28
- m_connection->refreshServerInfo ();
29
- } catch (const RedisClient::Connection::Exception& e) {
30
- emit m_events->error (
31
- QCoreApplication::translate (" RDM" , " Connection error: " ) +
32
- QString (e.what ()));
33
- return false ;
34
- }
35
- } else {
36
- try {
37
- connected = m_connection->connect (true );
38
- } catch (const RedisClient::Connection::Exception& e) {
39
- emit m_events->error (
40
- QCoreApplication::translate (" RDM" , " Connection error: " ) +
41
- QString (e.what ()));
42
- return false ;
43
- }
24
+ auto connection = m_connection->clone ();
25
+
26
+ bool connected = false ;
27
+
28
+ try {
29
+ connected = connection->connect (true );
30
+ } catch (const RedisClient::Connection::Exception& e) {
31
+ emit m_events->error (
32
+ QCoreApplication::translate (" RDM" , " Connection error: " ) +
33
+ QString (e.what ()));
34
+ return false ;
44
35
}
45
36
46
37
if (!connected) {
47
38
emit m_events->error (
48
39
QCoreApplication::translate (
49
40
" RDM" , " Cannot connect to server '%1'. Check log for details." )
50
- .arg (m_connection ->getConfig ().name ()));
41
+ .arg (connection ->getConfig ().name ()));
51
42
return false ;
52
43
}
53
44
54
- RedisClient::DatabaseList availableDatabeses =
55
- m_connection->getKeyspaceInfo ();
45
+ RedisClient::DatabaseList availableDatabeses = connection->getKeyspaceInfo ();
56
46
57
- if (m_connection ->mode () != RedisClient::Connection::Mode::Cluster) {
47
+ if (connection ->mode () != RedisClient::Connection::Mode::Cluster) {
58
48
// detect all databases
59
49
RedisClient::Response scanningResp;
60
50
int lastDbIndex =
@@ -65,13 +55,13 @@ bool TreeOperations::loadDatabases(
65
55
availableDatabeses.insert (index, 0 );
66
56
}
67
57
} else {
68
- uint dbScanLimit = static_cast <ServerConfig>(m_connection ->getConfig ())
58
+ uint dbScanLimit = static_cast <ServerConfig>(connection ->getConfig ())
69
59
.databaseScanLimit ();
70
60
71
61
for (int index = lastDbIndex; index < dbScanLimit; index++) {
72
62
try {
73
63
scanningResp =
74
- m_connection ->commandSync (" select" , QString::number (index));
64
+ connection ->commandSync (" select" , QString::number (index));
75
65
} catch (const RedisClient::Connection::Exception& e) {
76
66
throw ConnectionsTree::Operations::Exception (
77
67
QCoreApplication::translate (" RDM" , " Connection error: " ) +
0 commit comments