@@ -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,18 @@ 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 (
28+ & self ,
29+ subdirectory_id : & str ,
30+ ) -> Result < RedisResult < Vec < u8 > > , Elapsed > {
2731 self . peek_with_timeout ( subdirectory_id, DEFAULT_COLUMN ) . await
2832 }
2933
3034 pub async fn push_v1 ( & self , subdirectory_id : & str , data : Vec < u8 > ) -> RedisResult < ( ) > {
3135 self . push ( subdirectory_id, PJ_V1_COLUMN , data) . await
3236 }
3337
34- pub async fn peek_v1 ( & self , subdirectory_id : & str ) -> Option < RedisResult < Vec < u8 > > > {
38+ pub async fn peek_v1 ( & self , subdirectory_id : & str ) -> Result < RedisResult < Vec < u8 > > , Elapsed > {
3539 self . peek_with_timeout ( subdirectory_id, PJ_V1_COLUMN ) . await
3640 }
3741
@@ -52,8 +56,8 @@ impl DbPool {
5256 & self ,
5357 subdirectory_id : & str ,
5458 channel_type : & str ,
55- ) -> Option < RedisResult < Vec < u8 > > > {
56- tokio:: time:: timeout ( self . timeout , self . peek ( subdirectory_id, channel_type) ) . await . ok ( )
59+ ) -> Result < RedisResult < Vec < u8 > > , Elapsed > {
60+ tokio:: time:: timeout ( self . timeout , self . peek ( subdirectory_id, channel_type) ) . await
5761 }
5862
5963 async fn peek ( & self , subdirectory_id : & str , channel_type : & str ) -> RedisResult < Vec < u8 > > {
0 commit comments