Adding a lot of heartbeating and OOBE work

This commit is contained in:
Rick Falkvinge
2017-01-16 22:09:09 +01:00
parent 789b06359d
commit adeeece59a
12 changed files with 138 additions and 347 deletions
+14 -1
View File
@@ -4,6 +4,7 @@ using System.Globalization;
using System.Threading;
using Mono.Unix;
using Mono.Unix.Native;
using Swarmops.Common.ExtensionMethods;
using Swarmops.Database;
using Swarmops.Logic.Communications;
using Swarmops.Logic.Communications.Payload;
@@ -25,7 +26,18 @@ namespace Swarmops.Backend
private static void Main (string[] args)
{
// Checking for schemata upgrade first of all
// Are we running yet?
if (!SystemSettings.DatabaseInitialized)
{
// will restart the service every 30s until db initialized on OOBE
// also, the read of DatabaseInitialized can and will fail if
// we're not initalized enough to even have a database
throw new InvalidOperationException();
}
// Checking for schemata upgrade first of all, after seeing that db exists
DatabaseMaintenance.UpgradeSchemata();
@@ -315,6 +327,7 @@ namespace Swarmops.Backend
{
BotLog.Write (0, "MainCycle", "Ten-second entry");
SystemSettings.HeartbeatBackend = (ulong) DateTime.UtcNow.ToUnix();
CommsTransmitter.Run();
try