Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/13/15 15:22:51 (9 years ago)
Author:
ascheibe
Message:

#2388

  • prevent disposing of hive data context
  • more cleanups
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HiveStatistics/sources/HeuristicLab.Services.Hive/3.3/HiveJanitor.cs

    r12789 r12858  
    5555
    5656    public void RunCleanup() {
     57      var pm = PersistenceManager;
    5758      while (!stop) {
    5859        try {
    5960          LogFactory.GetLogger(typeof(HiveJanitor).Namespace).Log("HiveJanitor: starting cleanup.");
    6061          bool cleanup = false;
    61           using (var pm = PersistenceManager) {
    62             var lifecycleDao = pm.LifecycleDao;
    63             pm.UseTransaction(() => {
    64               var lifecycle = lifecycleDao.GetLastLifecycle();
    65               if (lifecycle == null
    66                   || DateTime.Now - lifecycle.LastCleanup > HeuristicLab.Services.Hive.Properties.Settings.Default.CleanupInterval) {
    67                 lifecycleDao.UpdateLifecycle();
    68                 cleanup = true;
    69               }
    70               pm.SubmitChanges();
    71             }, true);
    72           }
     62
     63          var lifecycleDao = pm.LifecycleDao;
     64          pm.UseTransaction(() => {
     65            var lifecycle = lifecycleDao.GetLastLifecycle();
     66            if (lifecycle == null
     67                || DateTime.Now - lifecycle.LastCleanup > HeuristicLab.Services.Hive.Properties.Settings.Default.CleanupInterval) {
     68              lifecycleDao.UpdateLifecycle();
     69              cleanup = true;
     70            }
     71            pm.SubmitChanges();
     72          }, true);
     73
    7374          if (cleanup) {
    7475            EventManager.Cleanup();
Note: See TracChangeset for help on using the changeset viewer.