Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

index-parser: get the time in a cheaper way #1798

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,8 @@ private FileSystemTaskResult ParseIndex(
uint entryCount = this.ReadFromIndexHeader();

// Don't want to flood the logs on large indexes so only log every 500ms
const int LoggingTicksThreshold = 5000000;
long nextLogTicks = DateTime.UtcNow.Ticks + LoggingTicksThreshold;
const int LoggingTicksThreshold = 500;
int nextLogTicks = Environment.TickCount + LoggingTicksThreshold;

SortedFolderEntries.InitializePools(tracer, entryCount);
LazyUTF8String.InitializePools(tracer, entryCount);
Expand Down Expand Up @@ -329,10 +329,11 @@ private FileSystemTaskResult ParseIndex(
return result;
}

if (DateTime.UtcNow.Ticks > nextLogTicks)
int curTicks = Environment.TickCount;
if (curTicks - nextLogTicks > 0)
{
tracer.RelatedInfo($"{i}/{entryCount} index entries parsed.");
nextLogTicks = DateTime.UtcNow.Ticks + LoggingTicksThreshold;
nextLogTicks = curTicks + LoggingTicksThreshold;
}
}

Expand Down