Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/10/15 10:25:54 (10 years ago)
Author:
ascheibe
Message:

#2357 fixed removal of obsolete slaves

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Services.Hive/3.3/Manager/EventManager.cs

    r12012 r12172  
    122122    /// </summary>
    123123    private void DeleteObsoleteSlaves() {
    124       var slaves = dao.GetSlaves(x => x.IsDisposable.GetValueOrDefault() && x.SlaveState == SlaveState.Offline && (DateTime.Now - x.LastHeartbeat) > HeuristicLab.Services.Hive.Properties.Settings.Default.SweepInterval);
    125       foreach (DT.Slave slave in slaves) dao.DeleteSlave(slave.Id);
     124      var slaves = dao.GetSlaves(x => x.IsDisposable.GetValueOrDefault() &&
     125                                      x.SlaveState == SlaveState.Offline &&
     126                                      (DateTime.Now - x.LastHeartbeat) > Hive.Properties.Settings.Default.SweepInterval)
     127                                .Select(x => x.Id)
     128                                .ToArray();
     129
     130      foreach (Guid slaveId in slaves) {
     131        var downtimesAvailable = dao.GetDowntimes(x => x.ResourceId == slaveId).Any();
     132        if (!downtimesAvailable) {
     133          dao.DeleteSlave(slaveId);
     134        }
     135      }
    126136    }
    127137  }
Note: See TracChangeset for help on using the changeset viewer.