Skip to content

Commit 037d232

Browse files
authored
Mark admin clients as disconnected on error (#597)
1 parent b293376 commit 037d232

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/client.rs

+13-13
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,10 @@ pub async fn client_entrypoint(
155155

156156
if !client.is_admin() {
157157
let _ = drain.send(-1).await;
158+
}
158159

159-
if result.is_err() {
160-
client.stats.disconnect();
161-
}
160+
if result.is_err() {
161+
client.stats.disconnect();
162162
}
163163

164164
result
@@ -207,10 +207,10 @@ pub async fn client_entrypoint(
207207

208208
if !client.is_admin() {
209209
let _ = drain.send(-1).await;
210+
}
210211

211-
if result.is_err() {
212-
client.stats.disconnect();
213-
}
212+
if result.is_err() {
213+
client.stats.disconnect();
214214
}
215215

216216
result
@@ -261,10 +261,10 @@ pub async fn client_entrypoint(
261261

262262
if !client.is_admin() {
263263
let _ = drain.send(-1).await;
264+
}
264265

265-
if result.is_err() {
266-
client.stats.disconnect();
267-
}
266+
if result.is_err() {
267+
client.stats.disconnect();
268268
}
269269

270270
result
@@ -290,11 +290,12 @@ pub async fn client_entrypoint(
290290

291291
if !client.is_admin() {
292292
let _ = drain.send(-1).await;
293+
}
293294

294-
if result.is_err() {
295-
client.stats.disconnect();
296-
}
295+
if result.is_err() {
296+
client.stats.disconnect();
297297
}
298+
298299
result
299300
}
300301

@@ -1811,7 +1812,6 @@ impl<S, T> Drop for Client<S, T> {
18111812

18121813
// Dirty shutdown
18131814
// TODO: refactor, this is not the best way to handle state management.
1814-
18151815
if self.connected_to_server && self.last_server_stats.is_some() {
18161816
self.last_server_stats.as_ref().unwrap().idle();
18171817
}

0 commit comments

Comments
 (0)