Skip to content

Commit

Permalink
Improve: Clarify last updated date is in UTC
Browse files Browse the repository at this point in the history
  • Loading branch information
Sewer56 committed Oct 2, 2024
1 parent 039e8da commit 3438784
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public ModUpdateMixin(ModUpdate update, GameId gameId)
public static IEnumerable<ModUpdateMixin> FromUpdateResults(IEnumerable<ModUpdate> updates, GameId gameId) => updates.Select(update => new ModUpdateMixin(update, gameId));

/// <inheritdoc />
public DateTime GetLastUpdatedDate() => _lastUpdatedDate;
public DateTime GetLastUpdatedDateUtc() => _lastUpdatedDate;

/// <inheritdoc />
public UidForMod GetUniqueId() => new()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public struct PageMetadataMixin : ICanGetUidForMod, ICanGetLastUpdatedTimestamp
public EntityId GetModPageEntityId() => _metadata.Id;

/// <inheritodc/>
public DateTime GetLastUpdatedDate() => _metadata.UpdatedAt; // <= TODO: Change this with 'last file updated at' when V2 supports this field.
public DateTime GetLastUpdatedDateUtc() => _metadata.UpdatedAt; // <= TODO: Change this with 'last file updated at' when V2 supports this field.

/// <summary>
/// Returns the database entries containing page metadata(s) as a mixin.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public PerFeedCacheUpdater(TUpdateableItem[] items, TimeSpan expiry)
var minCachedDate = utcNow - expiry;
for (var x = 0; x < _items.Length; x++)
{
if (_items[x].GetLastUpdatedDate() < minCachedDate)
if (_items[x].GetLastUpdatedDateUtc() < minCachedDate)
_actions[x] = CacheUpdaterAction.NeedsUpdate;
}
}
Expand Down Expand Up @@ -98,7 +98,7 @@ internal void UpdateSingleItem<T>(T item) where T : ICanGetLastUpdatedTimestamp,
var existingItem = _items[index];

// If the file timestamp is newer than our cached copy, the item needs updating.
if (item.GetLastUpdatedDate() > existingItem.GetLastUpdatedDate())
if (item.GetLastUpdatedDateUtc() > existingItem.GetLastUpdatedDateUtc())
_actions[index] = CacheUpdaterAction.NeedsUpdate;
else
_actions[index] = CacheUpdaterAction.UpdateLastCheckedTimestamp;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ public interface ICanGetLastUpdatedTimestamp
/// Retrieves the time the item was last updated.
/// This date is in UTC.
/// </summary>
public DateTime GetLastUpdatedDate();
public DateTime GetLastUpdatedDateUtc();
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class TestItem : ICanGetLastUpdatedTimestamp, ICanGetUidForMod
public DateTime LastUpdated { get; set; }
public UidForMod Uid { get; set; }

public DateTime GetLastUpdatedDate() => LastUpdated;
public DateTime GetLastUpdatedDateUtc() => LastUpdated;
public UidForMod GetUniqueId() => Uid;

// Helper method to create a test item
Expand Down

0 comments on commit 3438784

Please sign in to comment.