diff --git a/Libraries/SPTarkov.Server.Core/Services/RagfairOfferService.cs b/Libraries/SPTarkov.Server.Core/Services/RagfairOfferService.cs index b1fc2d1f..52abab2e 100644 --- a/Libraries/SPTarkov.Server.Core/Services/RagfairOfferService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/RagfairOfferService.cs @@ -151,11 +151,16 @@ public class RagfairOfferService( } /// - /// Process stored offer ids and remove expired + /// Process cached expired offer ids /// public void RemoveExpiredOffers() { - ragfairOfferHolder.RemoveExpiredOffers(); + // Gather all stale offers + var staleOffersIds = ragfairOfferHolder.GetStaleOfferIds(); + foreach (var offerId in staleOffersIds) + { + ProcessStaleOffer(offerId); + } // Clear out expired offer ids now we've regenerated them ragfairOfferHolder.ResetExpiredOfferIds(); diff --git a/Libraries/SPTarkov.Server.Core/Utils/RagfairOfferHolder.cs b/Libraries/SPTarkov.Server.Core/Utils/RagfairOfferHolder.cs index a3177ae0..cd0c334d 100644 --- a/Libraries/SPTarkov.Server.Core/Utils/RagfairOfferHolder.cs +++ b/Libraries/SPTarkov.Server.Core/Utils/RagfairOfferHolder.cs @@ -36,6 +36,15 @@ public class RagfairOfferHolder( return _offersById.GetValueOrDefault(id); } + /// + /// Get a ragfair offer by its id + /// + /// RagfairOffer + public HashSet GetStaleOfferIds() + { + return _expiredOfferIds; + } + /// /// Get ragfair offers that match the passed in tpl ///