Commit 887aa9f
authored
fix: preserve ListFilesCache TTL when not set in config (#19401)
## Which issue does this PR close?
Closes #19396.
## Rationale for this change
Previously, when a `DefaultListFilesCache` was created with a TTL (e.g.,
`DefaultListFilesCache::new(1024, Some(Duration::from_secs(1)))`) and
passed to `CacheManagerConfig` without explicitly setting
`list_files_cache_ttl`, the cache's TTL would be unexpectedly unset
(overwritten to `None`).
This happened because `CacheManager::try_new()` always called
`update_cache_ttl(config.list_files_cache_ttl)`, even when the config
value was `None`.
## What changes are included in this PR?
- Modified `CacheManager::try_new()` to only update the cache's TTL if
`config.list_files_cache_ttl` is explicitly set (`Some(value)`). If the
config TTL is `None`, the cache's existing TTL is preserved.
- Added two test cases:
- `test_ttl_preserved_when_not_set_in_config`: Verifies that TTL is
preserved when not set in config
- `test_ttl_overridden_when_set_in_config`: Verifies that TTL can still
be overridden when explicitly set in config
## Are these changes tested?
Yes
## Are there any user-facing changes?
Yes1 parent 75d2473 commit 887aa9f
1 file changed
+78
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
196 | 196 | | |
197 | 197 | | |
198 | 198 | | |
199 | | - | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
200 | 203 | | |
201 | 204 | | |
202 | 205 | | |
| |||
350 | 353 | | |
351 | 354 | | |
352 | 355 | | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
0 commit comments