Class BoostExpiryService
- Namespace
- UsluzionicaServer.Infrastructure
- Assembly
- UsluzionicaServer.dll
Background servis koji svakih sat vremena pronalazi i deaktivira istekle boostove.
Logika pri isticanju boosta: listing.BoostScore -= boost.TokensSpent / boost.DurationDays boost.IsActive = false
Ako listing više nema ni jednog aktivnog boosta: listing.IsBoosted = false listing.BoostScore = 0 (cleanup floating point ostataka) listing.BoostExpiresAt = null
Koristi IServiceScopeFactory jer je BackgroundService singleton a AppDbContext je scoped — ne smeju se mešati lifetime-ovi.
public sealed class BoostExpiryService : BackgroundService, IHostedService, IDisposable
- Inheritance
-
BoostExpiryService
- Implements
- Inherited Members
Constructors
- BoostExpiryService(IServiceScopeFactory, DistributedLock, ILogger<BoostExpiryService>)
Background servis koji svakih sat vremena pronalazi i deaktivira istekle boostove.
Logika pri isticanju boosta: listing.BoostScore -= boost.TokensSpent / boost.DurationDays boost.IsActive = false
Ako listing više nema ni jednog aktivnog boosta: listing.IsBoosted = false listing.BoostScore = 0 (cleanup floating point ostataka) listing.BoostExpiresAt = null
Koristi IServiceScopeFactory jer je BackgroundService singleton a AppDbContext je scoped — ne smeju se mešati lifetime-ovi.
Methods
- ExecuteAsync(CancellationToken)
This method is called when the IHostedService starts. The implementation should return a task that represents the lifetime of the long running operation(s) being performed.