xonx4l commented on code in PR #19140:
URL: https://github.com/apache/datafusion/pull/19140#discussion_r2596233109


##########
datafusion/execution/src/cache/list_files_cache.rs:
##########
@@ -55,6 +75,19 @@ impl DefaultListFilesCache {
     pub fn new(memory_limit: usize, ttl: Option<Duration>) -> Self {
         Self {
             state: Mutex::new(DefaultListFilesCacheState::new(memory_limit, 
ttl)),
+            time_provider: Arc::new(SystemTimeProvider),
+        }
+    }
+
+    #[cfg(test)]
+    pub fn new_with_provider(

Review Comment:
   Thanks for the review!
   
   I agree it doesn't need to be fully public. I will update it to pub(crate).
   My concern with fn with_time_provider()  is that it technically creates a 
live instance using the SystemTimeProvider first, and then mutates it. I prefer 
enforcing at the type/constructor level that this specific test instance is 
instantiated with the Mock immediately. This guarantees the object is never in 
a state where it interacts with the real system clock, avoiding any potential 
side effects during setup.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to