Skip to content

Commit

Permalink
T #98 cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
HueByte committed Oct 9, 2022
1 parent 26548ee commit 658b465
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/Huppy/Huppy.Core/Services/Reminder/ReminderService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ public class ReminderService : IReminderService
private readonly ILogger _logger;
private readonly IEventLoopService _eventService;
private readonly InteractionService _interactionService;
private DateTime FetchingDate => DateTime.UtcNow + FetchReminderFrequency;
public TimeSpan FetchReminderFrequency { get; } = new(0, 0, 30);
private readonly ReminderProto.ReminderProtoClient _reminderClient;
private readonly CacheStorageService _cacheStorage;
private DateTime FetchingDate => DateTime.UtcNow + FetchReminderFrequency;
public TimeSpan FetchReminderFrequency { get; } = new(0, 0, 30);
public ReminderService(IEventLoopService eventService, ILogger<ReminderService> logger, DiscordShardedClient discord, InteractionService interactionService, ITimedEventsService timedEventsService, ReminderProto.ReminderProtoClient reminderClient, CacheStorageService cacheStorage)
{
_eventService = eventService;
Expand Down Expand Up @@ -113,10 +113,9 @@ public async Task AddReminderAsync(DateTime date, IUser user, string message)

_logger.LogInformation("Added reminder for [{user}] at [{date}] UTC", user.Username, date);

// date - error margin
// with error margin
if (date < _cacheStorage.NextReminderFetchingDate - new TimeSpan(0, 0, 5))
{
_logger.LogInformation("Adding reminder before refresh");
await _eventService.AddEvent(date, reminder.Id.ToString()!, reminderInput, async (input) =>
{
if (input is ReminderInput data)
Expand Down

0 comments on commit 658b465

Please sign in to comment.