Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit b68d764

Browse files
author
Steven Kirk
committed
Fix logic around only sending stats once per day.
1 parent a8eb974 commit b68d764

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/GitHub.Exports/Services/UsageTracker.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -173,14 +173,13 @@ async void TimerTick(object sender, EventArgs e)
173173
var includeMonthly = lastDate.Month != currentDate.Month;
174174

175175
// Only send stats once a day.
176-
if (lastDate != currentDate)
176+
if (lastDate.Date != currentDate.Date)
177177
{
178178
await SendUsage(includeWeekly, includeMonthly);
179+
ClearCounters(includeWeekly, includeMonthly);
180+
usage.LastUpdated = DateTimeOffset.Now.UtcDateTime;
181+
SaveUsage(usage);
179182
}
180-
181-
ClearCounters(includeWeekly, includeMonthly);
182-
usage.LastUpdated = DateTimeOffset.Now.UtcDateTime;
183-
SaveUsage(usage);
184183
}
185184
catch //(Exception ex)
186185
{

0 commit comments

Comments
 (0)