Skip to content

Commit 5652a03

Browse files
committed
Address follow-up comments on #24
(cherry picked from commit fdf9b46)
1 parent 1fbc6f1 commit 5652a03

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

src/NuGet.Server.Core/Infrastructure/ServerPackageRepository.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff 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)

0 commit comments

Comments
 (0)