Skip to content

Commit

Permalink
Null Observer Exception (#161)
Browse files Browse the repository at this point in the history
* Null Observer Exception

This need further investigation

* DefaultRepositoryMonitor.cs cleaning

* add comment
  • Loading branch information
gabriel-vanca authored Sep 7, 2024
1 parent 73f05d2 commit 374d611
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/RepoM.Api/Git/DefaultRepositoryMonitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,12 @@ public void Reset()

foreach (IRepositoryObserver observer in _repositoryObservers.Values)
{
// ReSharper disable once ConditionIsAlwaysTrueOrFalseAccordingToNullableAPIContract
if (observer == null)
{
_logger.LogError("Null Observer in _repositoryObservers detected");
continue;
}
observer.Stop();
observer.Dispose();
}
Expand Down Expand Up @@ -285,7 +291,7 @@ private void OnRepositoryChangeDetected(IRepository repo)
_logger.LogDebug("{Method} - create observer {Head}", nameof(OnRepositoryChangeDetected), repo.Path);
CreateRepositoryObserver(repo, path);

// use that delay to prevent a lot of sequential writes
// use that delay to prevent a lot of sequential writes
// when a lot of repositories get found in a row
_storeFlushTimer.Change(5000, Timeout.Infinite);
}
Expand Down Expand Up @@ -349,4 +355,4 @@ private enum KnownRepositoryNotifications
WhenFound = 1,
WhenNotFound = 2,
}
}
}

0 comments on commit 374d611

Please sign in to comment.