Update sbot.rs to new history_stream api
continuous-integration/drone/pr Build is passing Details

This commit is contained in:
notplants 2022-07-07 13:42:32 +02:00
parent 90badbfe30
commit 466db8ceea
1 changed files with 6 additions and 1 deletions

View File

@ -8,6 +8,7 @@ use std::{
process::{Command, Output},
};
use async_std::stream::StreamExt;
use async_std::task;
use dirs;
use futures::stream::TryStreamExt;
@ -134,7 +135,11 @@ pub fn latest_sequence_number() -> Result<u64, Box<dyn Error>> {
let id = sbot_client.whoami().await?;
let history_stream = sbot_client.create_history_stream(id).await?;
let mut msgs: Vec<SsbMessageValue> = history_stream.try_collect().await?;
let msg_stream = history_stream.map(|res| match res {
Ok(kvt) => Ok(kvt.value),
Err(err) => Err(err),
});
let mut msgs: Vec<SsbMessageValue> = msg_stream.try_collect().await?;
// there will be zero messages when the sbot is run for the first time
if msgs.is_empty() {