async_db: add WriterSink
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				continuous-integration/drone/push Build is passing
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	continuous-integration/drone/push Build is passing
				
			This commit is contained in:
		@@ -178,15 +178,11 @@ async fn db_writer_task(rx: UnboundedReceiver<Question>) {
 | 
			
		||||
    let mut writer: async_db::Writer<Question> =
 | 
			
		||||
        async_db::Writer::new(NEW_DB_FILENAME, writer_opts)
 | 
			
		||||
            .await
 | 
			
		||||
            .expect("new db writer");
 | 
			
		||||
 | 
			
		||||
    let mut stream: UnboundedReceiverStream<_> = rx.into();
 | 
			
		||||
 | 
			
		||||
    writer
 | 
			
		||||
        .load(&mut stream)
 | 
			
		||||
        .await
 | 
			
		||||
        .unwrap_or_else(|e| panic!("db writer load, {e:#?}"));
 | 
			
		||||
            .unwrap_or_else(|e| panic!("db writer load, {e:#?}"));
 | 
			
		||||
 | 
			
		||||
    let stream: UnboundedReceiverStream<_> = rx.into();
 | 
			
		||||
    let stream = stream.map(Ok);
 | 
			
		||||
    stream.forward(writer.sink()).await.expect("forward");
 | 
			
		||||
    writer.finish().await.expect("db writer finish");
 | 
			
		||||
 | 
			
		||||
    println!("write done");
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user