Skip to content

Commit 8ff5965

Browse files
authored
Change ShardRunner::request_restart's return type to nothing (#3003)
The function does not actually return an error in any situation.
1 parent 6aa64f6 commit 8ff5965

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

src/gateway/bridge/shard_runner.rs

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ impl ShardRunner {
108108
if !self.shard.do_heartbeat().await {
109109
warn!("[ShardRunner {:?}] Error heartbeating", self.shard.shard_info(),);
110110

111-
return self.request_restart().await;
111+
self.request_restart().await;
112+
return Ok(());
112113
}
113114

114115
let pre = self.shard.stage();
@@ -133,7 +134,8 @@ impl ShardRunner {
133134

134135
match action {
135136
Some(ShardAction::Reconnect(ReconnectType::Reidentify)) => {
136-
return self.request_restart().await;
137+
self.request_restart().await;
138+
return Ok(());
137139
},
138140
Some(other) => {
139141
if let Err(e) = self.action(&other).await {
@@ -144,7 +146,10 @@ impl ShardRunner {
144146
e
145147
);
146148
match self.shard.reconnection_type() {
147-
ReconnectType::Reidentify => return self.request_restart().await,
149+
ReconnectType::Reidentify => {
150+
self.request_restart().await;
151+
return Ok(());
152+
},
148153
ReconnectType::Resume => {
149154
if let Err(why) = self.shard.resume().await {
150155
warn!(
@@ -153,7 +158,8 @@ impl ShardRunner {
153158
why
154159
);
155160

156-
return self.request_restart().await;
161+
self.request_restart().await;
162+
return Ok(());
157163
}
158164
},
159165
};
@@ -177,7 +183,8 @@ impl ShardRunner {
177183
}
178184

179185
if !successful && !self.shard.stage().is_connecting() {
180-
return self.request_restart().await;
186+
self.request_restart().await;
187+
return Ok(());
181188
}
182189
trace!("[ShardRunner {:?}] loop iteration reached the end.", self.shard.shard_info());
183190
}
@@ -199,7 +206,10 @@ impl ShardRunner {
199206
#[instrument(skip(self, action))]
200207
async fn action(&mut self, action: &ShardAction) -> Result<()> {
201208
match *action {
202-
ShardAction::Reconnect(ReconnectType::Reidentify) => self.request_restart().await,
209+
ShardAction::Reconnect(ReconnectType::Reidentify) => {
210+
self.request_restart().await;
211+
Ok(())
212+
},
203213
ShardAction::Reconnect(ReconnectType::Resume) => self.shard.resume().await,
204214
ShardAction::Heartbeat => self.shard.heartbeat().await,
205215
ShardAction::Identify => self.shard.identify().await,
@@ -356,7 +366,7 @@ impl ShardRunner {
356366
self.shard.shard_info(),
357367
);
358368

359-
drop(self.request_restart().await);
369+
self.request_restart().await;
360370
return Ok(false);
361371
},
362372
Err(_) => break,
@@ -443,7 +453,7 @@ impl ShardRunner {
443453
}
444454

445455
#[instrument(skip(self))]
446-
async fn request_restart(&mut self) -> Result<()> {
456+
async fn request_restart(&mut self) {
447457
debug!("[ShardRunner {:?}] Requesting restart", self.shard.shard_info());
448458

449459
self.update_manager().await;
@@ -455,8 +465,6 @@ impl ShardRunner {
455465
if let Some(voice_manager) = &self.voice_manager {
456466
voice_manager.deregister_shard(shard_id.0).await;
457467
}
458-
459-
Ok(())
460468
}
461469

462470
#[instrument(skip(self))]

0 commit comments

Comments
 (0)