- Timestamp:
- 06/05/09 14:40:53 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Hive.Client.Core/3.2/Heartbeat.cs
r1936 r2025 39 39 /// </summary> 40 40 public class Heartbeat { 41 42 private bool offline; 43 41 44 public double Interval { get; set; } 42 45 private Timer heartbeatTimer = null; … … 72 75 void heartbeatTimer_Elapsed(object sender, ElapsedEventArgs e) { 73 76 Console.WriteLine("tick"); 74 ClientInfo info = ConfigManager.Instance.GetClientInfo(); 75 // Todo: remove tempfix for free cores. 77 ClientInfo info = ConfigManager.Instance.GetClientInfo(); 76 78 77 79 PerformanceCounter counter = new PerformanceCounter("Memory", "Available Bytes", true); 78 80 int mb = (int)(counter.NextValue() / 1024 / 1024); 79 80 81 81 82 82 HeartBeatData heartBeatData = new HeartBeatData { … … 84 84 FreeCores = info.NrOfCores - ConfigManager.Instance.GetUsedCores(), 85 85 FreeMemory = mb, 86 JobProgress = ConfigManager.Instance.GetProgressOfAllJobs() 86 JobProgress = ConfigManager.Instance.GetProgressOfAllJobs() 87 87 }; 88 89 DateTime lastFullHour = DateTime.Parse(DateTime.Now.Hour.ToString() + ":00"); 90 TimeSpan span = DateTime.Now - lastFullHour; 91 if (span.TotalSeconds < (Interval/1000)) { 92 if (UptimeManager.Instance.isOnline()) { 93 //That's quiet simple: Just reconnect and you're good for new jobs 94 if (wcfService.ConnState != NetworkEnum.WcfConnState.Connected) { 95 Logging.Instance.Info(this.ToString(), "Client goes online according to timetable"); 96 wcfService.Connect(); 97 } 98 } else { 99 //We have quit a lot of work to do here: snapshot all jobs, submit them back, then disconnect and then pray to god that nothing goes wrong 100 MessageQueue.GetInstance().AddMessage(MessageContainer.MessageType.UptimeLimitDisconnect); 101 } 102 } 88 103 if (wcfService.ConnState == NetworkEnum.WcfConnState.Failed) { 89 104 wcfService.Connect();
Note: See TracChangeset
for help on using the changeset viewer.