Skip to content

Commit 0059dff

Browse files
Merge pull request #486 from dwall-rs/dev
2 parents 699f3ab + bee9aff commit 0059dff

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

daemon/src/domain/visual/theme_processor.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -348,13 +348,18 @@ static SOLAR_CACHE: OnceCell<Mutex<HashMap<PathBuf, Vec<SolarAngle>>>> = OnceCel
348348

349349
/// Load solar configuration for a specific theme directory
350350
async fn load_cached_solar_angles(theme_directory: &Path) -> DwallResult<Vec<SolarAngle>> {
351+
let theme_directory = theme_directory.canonicalize()?;
352+
debug!(path = %theme_directory.display(), "Loading solar configuration from canonical and absolute path");
353+
351354
let cache = SOLAR_CACHE
352355
.get_or_init(|| async { Mutex::new(HashMap::new()) })
353356
.await;
357+
358+
let mut cache_lock = cache.lock().await;
359+
354360
// Check cache
355361
{
356-
let cache_lock = cache.lock().await;
357-
if let Some(cached_angles) = cache_lock.get(theme_directory) {
362+
if let Some(cached_angles) = cache_lock.get(&theme_directory) {
358363
debug!("Using cached solar configuration");
359364
return Ok(cached_angles.clone());
360365
}
@@ -396,11 +401,10 @@ async fn load_cached_solar_angles(theme_directory: &Path) -> DwallResult<Vec<Sol
396401
solar_angles_count = solar_angles.len(),
397402
"Successfully loaded solar configuration"
398403
);
404+
399405
// Cache solar configuration
400-
{
401-
let mut cache_lock = cache.lock().await;
402-
cache_lock.insert(theme_directory.to_path_buf(), solar_angles.clone());
403-
}
406+
cache_lock.insert(theme_directory.to_path_buf(), solar_angles.clone());
407+
404408
Ok(solar_angles)
405409
}
406410

0 commit comments

Comments
 (0)