File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ impl FlushControl {
7575 . expect ( "unable to poll clock, unrecoverable" )
7676 . as_secs ( ) ;
7777 match & self . flush_strategy {
78- FlushStrategy :: Default => {
78+ FlushStrategy :: Default | FlushStrategy :: Periodically ( _ ) => {
7979 if now - self . last_flush > ( TWENTY_SECONDS / 1000 ) {
8080 self . last_flush = now;
8181 true
@@ -118,6 +118,7 @@ mod tests {
118118 let mut flush_control = super :: FlushControl :: new ( FlushStrategy :: Default ) ;
119119 assert ! ( flush_control. should_flush_end( ) ) ;
120120 }
121+
121122 #[ test]
122123 fn should_flush_default_periodic ( ) {
123124 const LOOKBACK_COUNT : usize = 20 ;
@@ -128,6 +129,15 @@ mod tests {
128129 assert ! ( !flush_control. should_flush_end( ) ) ;
129130 }
130131
132+ #[ test]
133+ fn should_flush_custom_periodic ( ) {
134+ let mut flush_control =
135+ super :: FlushControl :: new ( FlushStrategy :: Periodically ( PeriodicStrategy {
136+ interval : 1 ,
137+ } ) ) ;
138+ assert ! ( flush_control. should_periodic_flush( ) ) ;
139+ }
140+
131141 #[ tokio:: test]
132142 async fn get_flush_interval ( ) {
133143 let flush_control = FlushControl :: new ( FlushStrategy :: Default ) ;
You can’t perform that action at this time.
0 commit comments