diff options
Diffstat (limited to 'serialize.cpp')
-rw-r--r-- | serialize.cpp | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/serialize.cpp b/serialize.cpp index 29bd640..b59ff46 100644 --- a/serialize.cpp +++ b/serialize.cpp @@ -2,11 +2,8 @@ #include <experimental/filesystem> #include <cereal/archives/json.hpp> #include <fstream> -#include <unistd.h> #include "serialize.hpp" #include <sdbusplus/server.hpp> -#include <phosphor-logging/log.hpp> -#include <chrono> namespace phosphor { @@ -17,9 +14,6 @@ namespace updater namespace fs = std::experimental::filesystem; -using namespace phosphor::logging; -using namespace std::chrono_literals; - void storeToFile(std::string versionId, uint8_t priority) { auto bus = sdbusplus::bus::new_default(); @@ -40,10 +34,6 @@ void storeToFile(std::string versionId, uint8_t priority) SYSTEMD_INTERFACE, "StartUnit"); method.append(serviceFile, "replace"); bus.call_noreply(method); - - // On average it takes 1-2 seconds for the service to complete. - // Therefore timeout is set to 3x average completion time. - waitForServiceFile(serviceFile, 6); } bool restoreFromFile(std::string versionId, uint8_t& priority) @@ -114,37 +104,6 @@ void removeFile(std::string versionId) } } -void waitForServiceFile(const std::string& serviceFile, int timeout) -{ - auto bus = sdbusplus::bus::new_default(); - - std::time_t start = time(0); - std::time_t end = time(0); - - while (end - start < timeout) - { - auto method = bus.new_method_call(SYSTEMD_BUSNAME, SYSTEMD_PATH, - SYSTEMD_INTERFACE, "GetUnit"); - method.append(serviceFile); - auto result = bus.call(method); - - // "GetUnit" returns the unit object path for a unit name. - // If the unit is not found because it hasn't been loaded yet, - // or in this case because it has finished and exited, the call - // will fail. - if (result.is_method_error()) - { - return; - } - - std::this_thread::sleep_for(1s); - end = time(0); - } - - log<level::ERR>("Service file timed out!", - entry("FILENAME=%s", serviceFile.c_str())); -} - } // namespace phosphor } // namespace software } // namespace openpower |