Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
R0nd committed Oct 16, 2021
1 parent fa47025 commit c04e749
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ fn main() -> Result<()> {
let mut first_update = true;

loop {
const BATCH_SIZE: usize = 10;

let event_batch = if first_update {
first_update = false;
vec![QueueEvent::Tick]
Expand All @@ -155,8 +157,6 @@ fn main() -> Result<()> {
};

let mut flags = NeedsUpdate::empty();
const BATCH_SIZE: usize = 10;

for event in event_batch.iter().take(BATCH_SIZE) {
if let QueueEvent::SpinnerUpdate = event {
spinner.update();
Expand Down Expand Up @@ -267,8 +267,8 @@ fn select_event(
let index = oper.index();

if index == 0 {
let mut batch: Vec<QueueEvent> = Vec::new();
batch.push(oper.recv(rx_input).map(QueueEvent::InputEvent)?);
let mut batch =
vec![oper.recv(rx_input).map(QueueEvent::InputEvent)?];
while let Ok(ev) = rx_input.try_recv() {
batch.push(QueueEvent::InputEvent(ev));
}
Expand Down

0 comments on commit c04e749

Please sign in to comment.