From f74d52b1e14975184c6fc8bbee0cdacb89c1c222 Mon Sep 17 00:00:00 2001 From: Raigo Kovask Date: Mon, 20 May 2024 17:33:51 +0300 Subject: [PATCH 1/2] fix: check if the lod file update time is creater than the updated avatar date --- .../Core/Scripts/Operations/MetadataDownloader.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Runtime/Core/Scripts/Operations/MetadataDownloader.cs b/Runtime/Core/Scripts/Operations/MetadataDownloader.cs index 61b0d0bb..8fab8815 100644 --- a/Runtime/Core/Scripts/Operations/MetadataDownloader.cs +++ b/Runtime/Core/Scripts/Operations/MetadataDownloader.cs @@ -129,7 +129,17 @@ private static bool IsUpdateRequired(AvatarContext context) return true; } AvatarMetadata previousMetadata = AvatarMetadata.LoadFromFile(context.AvatarUri.LocalMetadataPath); - return AvatarMetadata.IsUpdated(context.Metadata, previousMetadata); + return AvatarMetadata.IsUpdated(context.Metadata, previousMetadata) || ShouldUpdateAvatarFile(context); + } + + private static bool ShouldUpdateAvatarFile(AvatarContext context) + { + if (!File.Exists(context.AvatarUri.LocalModelPath)) + { + return true; + } + var avatarFileUpdateTime = File.GetLastWriteTime(context.AvatarUri.LocalModelPath); + return avatarFileUpdateTime < context.Metadata.UpdatedAt.ToLocalTime(); } /// From 9ed907a1f9f2ba8f627444fbe8b7939cd0cf9212 Mon Sep 17 00:00:00 2001 From: Raigo Kovask Date: Tue, 21 May 2024 10:40:04 +0300 Subject: [PATCH 2/2] chore: use UTC instead of local time --- Runtime/Core/Scripts/Operations/MetadataDownloader.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Runtime/Core/Scripts/Operations/MetadataDownloader.cs b/Runtime/Core/Scripts/Operations/MetadataDownloader.cs index 8fab8815..e3ff56e4 100644 --- a/Runtime/Core/Scripts/Operations/MetadataDownloader.cs +++ b/Runtime/Core/Scripts/Operations/MetadataDownloader.cs @@ -138,8 +138,8 @@ private static bool ShouldUpdateAvatarFile(AvatarContext context) { return true; } - var avatarFileUpdateTime = File.GetLastWriteTime(context.AvatarUri.LocalModelPath); - return avatarFileUpdateTime < context.Metadata.UpdatedAt.ToLocalTime(); + var avatarFileUpdateTime = File.GetLastWriteTimeUtc(context.AvatarUri.LocalModelPath); + return avatarFileUpdateTime < context.Metadata.UpdatedAt; } ///