Skip to content

Commit 85d0c61

Browse files
isabellanitsky
andauthored
feat: process indexing (#559)
Co-authored-by: David Yamnitsky <[email protected]>
1 parent 8603827 commit 85d0c61

File tree

5 files changed

+324
-75
lines changed

5 files changed

+324
-75
lines changed

packages/cli/src/progress.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@ impl<T> State<T> {
152152
.unwrap()
153153
.as_millis();
154154
for indicator in self.indicators.values() {
155-
const LENGTH: u64 = 20;
156155
const SPINNER: [char; 10] = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
157156
let mut line = String::new();
158157
let position = (now / (1000 / 10)) % 10;
@@ -166,19 +165,19 @@ impl<T> State<T> {
166165
title_length = title_length.unwrap(),
167166
)
168167
.unwrap();
168+
const LENGTH: u64 = 20;
169169
if let (Some(current), Some(total)) = (indicator.current, indicator.total) {
170-
let current = current.min(total);
171170
write!(line, " [").unwrap();
172-
let last = current * LENGTH / total;
173-
for _ in 0..last {
171+
let n = if total > 0 { current / total } else { 1 } * LENGTH;
172+
for _ in 0..n {
174173
write!(line, "=").unwrap();
175174
}
176175
if current < total {
177176
write!(line, ">").unwrap();
178177
} else {
179178
write!(line, "=").unwrap();
180179
}
181-
for _ in last..LENGTH {
180+
for _ in n..LENGTH {
182181
write!(line, " ").unwrap();
183182
}
184183
write!(line, "]").unwrap();

packages/messenger/src/memory.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ impl Messenger {
105105
payload: Bytes,
106106
) -> Result<impl Future<Output = Result<StreamPublishInfo, Error>>, Error> {
107107
let stream = self.streams.get(&name).ok_or(Error::NotFound)?.clone();
108-
let future = async move { stream.publish(payload).await };
108+
let future = stream.publish(payload).boxed();
109109
Ok(future)
110110
}
111111

0 commit comments

Comments
 (0)