Changeset 1118


Ignore:
Timestamp:
01/14/09 15:32:14 (12 years ago)
Author:
msteinbi
Message:

Implementing Lifecycle Management (#453)

Location:
trunk/sources
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Hive.Contracts/ApplicationConstants.cs

    r1096 r1118  
    66namespace HeuristicLab.Hive.Contracts {
    77  public class ApplicationConstants {
     8
     9    public static int HEARTBEAT_MAX_DIF = 30; // value in seconds
    810
    911    public static string RESPONSE_SERVERCONSOLE_LOGIN_SUCCESS = "Logged in";
  • trunk/sources/HeuristicLab.Hive.Server.Core/ClientCommunicator.cs

    r1103 r1118  
    5959            DateTime lastHbOfClient = lastHeartbeats[client.ClientId];
    6060            TimeSpan dif = DateTime.Now.Subtract(lastHbOfClient);
    61             Console.WriteLine(dif);
     61            // check if time between last hearbeat and now is greather than HEARTBEAT_MAX_DIF
     62            if (dif.Seconds > ApplicationConstants.HEARTBEAT_MAX_DIF) {
     63              // if client calculated jobs, the job must be reset
     64              if (client.State == State.calculating) {
     65                // check wich job the client was calculating and reset it
     66                foreach (Job job in allJobs) {
     67                  if (job.Client.ClientId == client.ClientId) {
     68                    // TODO check for job results
     69                    job.Client = null;
     70                    job.Percentage = 0;
     71                    job.State = State.idle;
     72                  }
     73                }
     74              }
     75             
     76              // client must be set offline
     77              client.State = State.offline;
     78              clientAdapter.Update(client);
     79              lastHeartbeats.Remove(client.ClientId);
     80            }
    6281          }
    6382        } else {
Note: See TracChangeset for help on using the changeset viewer.