File tree Expand file tree Collapse file tree
src/NuGet.Server.Core/Infrastructure Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ public class ServerPackageRepository
3434
3535 private readonly bool _runBackgroundTasks ;
3636 private FileSystemWatcher _fileSystemWatcher ;
37- private bool _isFileSystemWatcherSuppressed = false ;
37+ private bool _isFileSystemWatcherSuppressed ;
3838 private bool _needsRebuild = true ;
3939
4040 private Timer _persistenceTimer ;
@@ -369,13 +369,23 @@ protected virtual void Dispose(bool disposing)
369369 }
370370
371371 /// <summary>
372- /// Internal package cache containing packages metadata.
372+ /// Package cache containing packages metadata.
373373 /// This data is generated if it does not exist already.
374374 /// </summary>
375375 private IEnumerable < ServerPackage > CachedPackages
376376 {
377377 get
378378 {
379+ /*
380+ * We rebuild the package storage under either of two conditions:
381+ *
382+ * 1. If the "needs rebuild" flag is set to true. This is initially the case when the repository is
383+ * instantiated, if a non-package drop file system event occurred (e.g. a file deletion), or if the
384+ * cache was manually cleared.
385+ *
386+ * 2. If the store has no packages at all. This is so we pick up initial packages as quickly as
387+ * possible.
388+ */
379389 if ( _needsRebuild || ! _serverPackageStore . HasPackages ( ) )
380390 {
381391 lock ( _syncLock )
You can’t perform that action at this time.
0 commit comments