refactor(inventory): share retention cap + invariant-culture date format
Introduce InventoryHistoryConfig.RetentionRowsPerViewer as the single source of truth for the 300-row audit-log cap; InventoryTransaction aliases it and ItemAcquireHistoryController.Take() references it directly so the two sites cannot drift. Also adds CultureInfo.InvariantCulture to the AcquireTime.ToString() call, matching every other WireDateFormat site in the codebase. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
15
SVSim.Database/Services/Inventory/InventoryHistoryConfig.cs
Normal file
15
SVSim.Database/Services/Inventory/InventoryHistoryConfig.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
namespace SVSim.Database.Services.Inventory;
|
||||
|
||||
/// <summary>
|
||||
/// Shared knobs for the viewer-acquire-history audit log. The write-side prune cap
|
||||
/// (in <c>InventoryTransaction</c>) and the read-side page size (in
|
||||
/// <c>ItemAcquireHistoryController</c>) both reference these constants so they cannot drift.
|
||||
/// </summary>
|
||||
public static class InventoryHistoryConfig
|
||||
{
|
||||
/// <summary>
|
||||
/// Maximum rows kept per viewer. Older rows are pruned by
|
||||
/// <c>InventoryTransaction.CommitAsync</c>; the read endpoint pages exactly this many.
|
||||
/// </summary>
|
||||
public const int RetentionRowsPerViewer = 300;
|
||||
}
|
||||
@@ -9,7 +9,7 @@ namespace SVSim.Database.Services.Inventory;
|
||||
|
||||
internal sealed class InventoryTransaction : IInventoryTransaction
|
||||
{
|
||||
private const int AcquireHistoryRetention = 300;
|
||||
private const int AcquireHistoryRetention = InventoryHistoryConfig.RetentionRowsPerViewer;
|
||||
|
||||
private readonly SVSimDbContext _db;
|
||||
private readonly IDbContextTransaction _dbTx;
|
||||
|
||||
Reference in New Issue
Block a user