- Notifications
You must be signed in to change notification settings - Fork5.2k
Avoiding loading and processing same cert file to improve cold start performance …#97267
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes from1 commit
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -198,27 +198,21 @@ bool ProcessDir(string dir, out DateTime lastModified) | ||
| foreach (string file in Directory.EnumerateFiles(dir)) | ||
| { | ||
| hasStoreData |= ProcessFile(file, out _); | ||
| } | ||
| return hasStoreData; | ||
| } | ||
| bool ProcessFile(string file, out DateTime lastModified) | ||
| { | ||
| bool readData = false; | ||
| if (!TryStatFile(file, out lastModified, out (long, long) fileId)) | ||
| { | ||
| return false; | ||
| } | ||
| if (processedFiles.Contains(fileId)) | ||
| { | ||
| return true; | ||
| } | ||
| @@ -290,7 +284,7 @@ bool ProcessFile(string file, out DateTime lastModified, bool skipStat = false) | ||
| if (readData) | ||
| { | ||
| processedFiles.Add(fileId); | ||
| } | ||
| return readData; | ||
| @@ -373,32 +367,28 @@ private static string[] GetRootStoreDirectories(out bool isDefault) | ||
| } | ||
| private static bool TryStatFile(string path, out DateTime lastModified) | ||
| => CallStat(path, Interop.Sys.FileTypes.S_IFREG, out lastModified, out _); | ||
| private static bool TryStatDirectory(string path, out DateTime lastModified) | ||
| => CallStat(path, Interop.Sys.FileTypes.S_IFDIR, out lastModified, out _); | ||
| private static bool TryStatFile(string path, out DateTime lastModified, out (long, long) fileId) | ||
| ||
| => CallStat(path, Interop.Sys.FileTypes.S_IFREG, out lastModified, out fileId); | ||
| private static bool CallStat(string path, int fileType, out DateTime lastModified, out (long, long) fileId) | ||
| { | ||
| lastModified = default; | ||
| fileId = default; | ||
| // Use Stat to follow links. | ||
| if (Interop.Sys.Stat(path, outInterop.Sys.FileStatusstatus) < 0 || | ||
| (status.Mode & Interop.Sys.FileTypes.S_IFMT) != fileType) | ||
| { | ||
| return false; | ||
| } | ||
| fileId = (status.Ino, status.Dev); | ||
| lastModified = DateTime.UnixEpoch + TimeSpan.FromTicks(status.MTime * TimeSpan.TicksPerSecond + status.MTimeNsec / TimeSpan.NanosecondsPerTick); | ||
| return true; | ||
| } | ||
| } | ||
| } | ||