77
88namespace GitHub . Unity
99{
10- abstract class ApplicationManagerBase : IApplicationManager
10+ class ApplicationManagerBase : IApplicationManager
1111 {
1212 protected static ILogging Logger { get ; } = LogHelper . GetLogger < IApplicationManager > ( ) ;
1313
@@ -45,9 +45,10 @@ protected void Initialize()
4545 {
4646 LogHelper . TracingEnabled = UserSettings . Get ( Constants . TraceLoggingKey , false ) ;
4747 ApplicationConfiguration . WebTimeout = UserSettings . Get ( Constants . WebTimeoutKey , ApplicationConfiguration . WebTimeout ) ;
48+ ApplicationConfiguration . GitTimeout = UserSettings . Get ( Constants . GitTimeoutKey , ApplicationConfiguration . GitTimeout ) ;
4849 Platform . Initialize ( ProcessManager , TaskManager ) ;
4950 progress . OnProgress += progressReporter . UpdateProgress ;
50- UsageTracker = new UsageTracker ( TaskManager , UserSettings , Environment , InstanceId . ToString ( ) ) ;
51+ UsageTracker = new UsageTracker ( TaskManager , GitClient , ProcessManager , UserSettings , Environment , InstanceId . ToString ( ) ) ;
5152
5253#if ENABLE_METRICS
5354 var metricsService = new MetricsService ( ProcessManager ,
@@ -191,7 +192,6 @@ public void SetupGit(GitInstaller.GitInstallationState state)
191192 if ( Environment . RepositoryPath . IsInitialized )
192193 {
193194 ConfigureMergeSettings ( ) ;
194- CaptureRepoSize ( ) ;
195195
196196 GitClient . LfsInstall ( )
197197 . Catch ( e =>
@@ -300,37 +300,6 @@ private void ConfigureMergeSettings()
300300 } ) . RunSynchronously ( ) ;
301301 }
302302
303- private void CaptureRepoSize ( )
304- {
305- GitClient . CountObjects ( )
306- . Finally ( ( success , gitObjects ) =>
307- {
308- if ( success )
309- {
310- UsageTracker . UpdateRepoSize ( gitObjects . kilobytes ) ;
311- }
312- } )
313- . Start ( ) ;
314-
315- var gitLfsDataPath = Environment . RepositoryPath . Combine ( ".git" , "lfs" ) ;
316- if ( gitLfsDataPath . Exists ( ) )
317- {
318- var diskUsageTask = Environment . IsWindows
319- ? ( IProcessTask < int > ) new WindowsDiskUsageTask ( gitLfsDataPath , TaskManager . Token )
320- : new LinuxDiskUsageTask ( gitLfsDataPath , TaskManager . Token ) ;
321-
322- diskUsageTask
323- . Configure ( ProcessManager )
324- . Finally ( ( success , kilobytes ) =>
325- {
326- if ( success )
327- {
328- UsageTracker . UpdateLfsDiskUsage ( kilobytes ) ;
329- }
330- } ) . Start ( ) ;
331- }
332- }
333-
334303 public void RestartRepository ( )
335304 {
336305 if ( ! Environment . RepositoryPath . IsInitialized )
@@ -346,8 +315,8 @@ public void RestartRepository()
346315 Logger . Trace ( $ "Got a repository? { ( Environment . Repository != null ? Environment . Repository . LocalPath : "null" ) } ") ;
347316 }
348317
349- protected abstract void InitializeUI ( ) ;
350- protected abstract void InitializationComplete ( ) ;
318+ protected virtual void InitializeUI ( ) { }
319+ protected virtual void InitializationComplete ( ) { }
351320
352321 private bool disposed = false ;
353322 protected virtual void Dispose ( bool disposing )
@@ -356,6 +325,10 @@ protected virtual void Dispose(bool disposing)
356325 {
357326 if ( disposed ) return ;
358327 disposed = true ;
328+ if ( ProcessManager != null )
329+ {
330+ ProcessManager . Stop ( ) ;
331+ }
359332 if ( TaskManager != null )
360333 {
361334 TaskManager . Dispose ( ) ;
0 commit comments