···144144 // holds up all consumer progress until it can send to the channel
145145 // use this when the current batch is too full to add more to it
146146 async fn send_current_batch_now(&mut self) -> anyhow::Result<()> {
147147- log::warn!("attempting to send batch now (capacity: {})", self.batch_sender.capacity());
147147+ log::warn!(
148148+ "attempting to send batch now (capacity: {})",
149149+ self.batch_sender.capacity()
150150+ );
148151 self.batch_sender
149152 .send_timeout(
150153 mem::take(&mut self.current_batch),
+18-10
ufos/src/main.rs
···2828 /// Location to store persist data to disk
2929 #[arg(long)]
3030 data: PathBuf,
3131+ /// DEBUG: don't start the jetstream consumer or its write loop
3232+ #[arg(long, action)]
3333+ pause_writer: bool,
3134 /// DEBUG: force the rw loop to fall behind by pausing it
3235 #[arg(long, action)]
3336 pause_rw: bool,
···4245 let (storage, cursor) =
4346 store::Storage::open(args.data, &args.jetstream, args.jetstream_force).await?;
44474545- println!(
4646- "starting consumer with cursor: {cursor:?} from {:?} ago",
4747- cursor.clone().map(|c| c.elapsed())
4848- );
4949- let batches = consumer::consume(&args.jetstream, cursor, args.jetstream_no_zstd).await?;
5050-5148 println!("starting server with storage...");
5249 let serving = server::serve(storage.clone());
5350···5653 log::warn!("serving ended with: {r:?}");
5754 });
58555959- let t2 = tokio::task::spawn({
5656+ let t2: tokio::task::JoinHandle<anyhow::Result<()>> = tokio::task::spawn({
6057 let storage = storage.clone();
6158 async move {
6262- let r = storage.receive(batches).await;
6363- log::warn!("storage.receive ended with: {r:?}");
5959+ if !args.pause_writer {
6060+ println!(
6161+ "starting consumer with cursor: {cursor:?} from {:?} ago",
6262+ cursor.clone().map(|c| c.elapsed())
6363+ );
6464+ let batches =
6565+ consumer::consume(&args.jetstream, cursor, args.jetstream_no_zstd).await?;
6666+ let r = storage.receive(batches).await;
6767+ log::warn!("storage.receive ended with: {r:?}");
6868+ } else {
6969+ log::info!("not starting jetstream or the write loop.");
7070+ }
7171+ Ok(())
6472 }
6573 });
6674···8290 log::trace!("tasks running. waiting.");
8391 t1.await?;
8492 log::trace!("serve task ended.");
8585- t2.await?;
9393+ t2.await??;
8694 log::trace!("storage receive task ended.");
8795 t3.await?;
8896 log::trace!("storage rw task ended.");