@@ -2,6 +2,7 @@ use std::time::Duration;
22
33use futures:: StreamExt ;
44use redis:: { AsyncCommands , Client , ErrorKind , RedisError , RedisResult } ;
5+ use tokio:: time:: error:: Elapsed ;
56use tracing:: debug;
67
78const DEFAULT_COLUMN : & str = "" ;
@@ -23,15 +24,15 @@ impl DbPool {
2324 self . push ( subdirectory_id, DEFAULT_COLUMN , data) . await
2425 }
2526
26- pub async fn peek_default ( & self , subdirectory_id : & str ) -> Option < RedisResult < Vec < u8 > > > {
27+ pub async fn peek_default ( & self , subdirectory_id : & str ) -> Result < RedisResult < Vec < u8 > > , Elapsed > {
2728 self . peek_with_timeout ( subdirectory_id, DEFAULT_COLUMN ) . await
2829 }
2930
3031 pub async fn push_v1 ( & self , subdirectory_id : & str , data : Vec < u8 > ) -> RedisResult < ( ) > {
3132 self . push ( subdirectory_id, PJ_V1_COLUMN , data) . await
3233 }
3334
34- pub async fn peek_v1 ( & self , subdirectory_id : & str ) -> Option < RedisResult < Vec < u8 > > > {
35+ pub async fn peek_v1 ( & self , subdirectory_id : & str ) -> Result < RedisResult < Vec < u8 > > , Elapsed > {
3536 self . peek_with_timeout ( subdirectory_id, PJ_V1_COLUMN ) . await
3637 }
3738
@@ -52,8 +53,8 @@ impl DbPool {
5253 & self ,
5354 subdirectory_id : & str ,
5455 channel_type : & str ,
55- ) -> Option < RedisResult < Vec < u8 > > > {
56- tokio:: time:: timeout ( self . timeout , self . peek ( subdirectory_id, channel_type) ) . await . ok ( )
56+ ) -> Result < RedisResult < Vec < u8 > > , Elapsed > {
57+ tokio:: time:: timeout ( self . timeout , self . peek ( subdirectory_id, channel_type) ) . await
5758 }
5859
5960 async fn peek ( & self , subdirectory_id : & str , channel_type : & str ) -> RedisResult < Vec < u8 > > {
0 commit comments