~aleteoryx/muditaos

f37159fff385a9ce9e1ec2e06698bbbafba6469a — Piotr Tański 5 years ago 0b9bca2
[EGD-5918] The system should crash on init failure

ServiceDB init process times out. Its timeout should be extended.
M module-services/service-db/ServiceDB.hpp => module-services/service-db/ServiceDB.hpp +1 -0
@@ 108,6 108,7 @@ namespace sys
#if ENABLE_FILEINDEXER_SERVICE
            manifest.dependencies = {service::name::file_indexer.data()};
#endif
            manifest.timeout = std::chrono::minutes{1};
            return manifest;
        }
    };

M module-sys/SystemManager/SystemManager.cpp => module-sys/SystemManager/SystemManager.cpp +1 -0
@@ 149,6 149,7 @@ namespace sys
            const auto startTimeout = service.get().getStartTimeout().count();
            if (const auto success = RunSystemService(service.get().create(), this, startTimeout); !success) {
                LOG_FATAL("Unable to start service: %s", service.get().getName().c_str());
                throw SystemInitialisationError{"System startup failed: unable to start a system service."};
            }
        });
    }

M module-sys/SystemManager/SystemManager.hpp => module-sys/SystemManager/SystemManager.hpp +7 -0
@@ 12,6 12,7 @@
#define SYSTEMMANAGER_SYSTEMMANAGER_HPP_

#include <functional>
#include <stdexcept>
#include "thread.hpp"
#include "condition_variable.hpp"
#include "mutex.hpp"


@@ 47,6 48,12 @@ namespace sys
        None,
    };

    class SystemInitialisationError : public std::runtime_error
    {
      public:
        using std::runtime_error::runtime_error;
    };

    class SystemManagerCmd : public DataMessage
    {
      public: