Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

Commit 7f9a033

Browse files
committed
Clean-up diff
1 parent 88dcdc2 commit 7f9a033

File tree

1 file changed

+40
-38
lines changed

1 file changed

+40
-38
lines changed

runtime/src/installed_scheduler_pool.rs

Lines changed: 40 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -297,33 +297,6 @@ impl BankWithScheduler {
297297
self.inner.scheduler.read().unwrap().is_some()
298298
}
299299

300-
#[must_use]
301-
pub fn wait_for_completed_scheduler(&self) -> Option<ResultWithTimings> {
302-
BankWithSchedulerInner::wait_for_scheduler(
303-
&self.inner.bank,
304-
&self.inner.scheduler,
305-
WaitReason::TerminatedToFreeze,
306-
)
307-
}
308-
309-
pub(crate) fn wait_for_paused_scheduler(bank: &Bank, scheduler: &InstalledSchedulerRwLock) {
310-
let maybe_result_with_timings = BankWithSchedulerInner::wait_for_scheduler(
311-
bank,
312-
scheduler,
313-
WaitReason::PausedForRecentBlockhash,
314-
);
315-
assert!(
316-
maybe_result_with_timings.is_none(),
317-
"Premature result was returned from scheduler after paused"
318-
);
319-
}
320-
321-
// take needless &mut only to communicate its semantic mutability to humans...
322-
#[cfg(feature = "dev-context-only-utils")]
323-
pub fn drop_scheduler(&mut self) {
324-
self.inner.drop_scheduler();
325-
}
326-
327300
// 'a is needed; anonymous_lifetime_in_impl_trait isn't stabilized yet...
328301
pub fn schedule_transaction_executions<'a>(
329302
&self,
@@ -342,12 +315,48 @@ impl BankWithScheduler {
342315
}
343316
}
344317

318+
// take needless &mut only to communicate its semantic mutability to humans...
319+
#[cfg(feature = "dev-context-only-utils")]
320+
pub fn drop_scheduler(&mut self) {
321+
self.inner.drop_scheduler();
322+
}
323+
324+
pub(crate) fn wait_for_paused_scheduler(bank: &Bank, scheduler: &InstalledSchedulerRwLock) {
325+
let maybe_result_with_timings = BankWithSchedulerInner::wait_for_scheduler(
326+
bank,
327+
scheduler,
328+
WaitReason::PausedForRecentBlockhash,
329+
);
330+
assert!(
331+
maybe_result_with_timings.is_none(),
332+
"Premature result was returned from scheduler after paused"
333+
);
334+
}
335+
336+
#[must_use]
337+
pub fn wait_for_completed_scheduler(&self) -> Option<ResultWithTimings> {
338+
BankWithSchedulerInner::wait_for_scheduler(
339+
&self.inner.bank,
340+
&self.inner.scheduler,
341+
WaitReason::TerminatedToFreeze,
342+
)
343+
}
344+
345345
pub const fn no_scheduler_available() -> InstalledSchedulerRwLock {
346346
RwLock::new(None)
347347
}
348348
}
349349

350350
impl BankWithSchedulerInner {
351+
#[must_use]
352+
fn wait_for_completed_scheduler_from_drop(&self) -> Option<ResultWithTimings> {
353+
Self::wait_for_scheduler(
354+
&self.bank,
355+
&self.scheduler,
356+
WaitReason::DroppedFromBankForks,
357+
)
358+
}
359+
351360
#[must_use]
352361
fn wait_for_scheduler(
353362
bank: &Bank,
@@ -383,16 +392,6 @@ impl BankWithSchedulerInner {
383392
result_with_timings
384393
}
385394

386-
#[must_use]
387-
fn wait_for_completed_scheduler_from_drop(&self) -> Option<Result<()>> {
388-
let maybe_result_with_timings = Self::wait_for_scheduler(
389-
&self.bank,
390-
&self.scheduler,
391-
WaitReason::DroppedFromBankForks,
392-
);
393-
maybe_result_with_timings.map(|(result, _timings)| result)
394-
}
395-
396395
fn drop_scheduler(&self) {
397396
if std::thread::panicking() {
398397
error!(
@@ -403,7 +402,10 @@ impl BankWithSchedulerInner {
403402
}
404403

405404
// There's no guarantee ResultWithTimings is available or not at all when being dropped.
406-
if let Some(Err(err)) = self.wait_for_completed_scheduler_from_drop() {
405+
if let Some(Err(err)) = self
406+
.wait_for_completed_scheduler_from_drop()
407+
.map(|(result, _timings)| result)
408+
{
407409
warn!(
408410
"BankWithSchedulerInner::drop(): slot: {} discarding error from scheduler: {:?}",
409411
self.bank.slot(),

0 commit comments

Comments
 (0)