loolwsd: process sleep for amount of time ...
specified by MAINTENANCE_INTERVAL
This commit is contained in:
parent
e107fa662c
commit
6dafcc753f
2 changed files with 17 additions and 1 deletions
|
@ -413,6 +413,7 @@ private:
|
|||
};
|
||||
|
||||
int LOOLWSD::portNumber = DEFAULT_CLIENT_PORT_NUMBER;
|
||||
int LOOLWSD::timeoutCounter = 0;
|
||||
std::string LOOLWSD::cache = LOOLWSD_CACHEDIR;
|
||||
std::string LOOLWSD::sysTemplate;
|
||||
std::string LOOLWSD::loTemplate;
|
||||
|
@ -954,6 +955,13 @@ void LOOLWSD::desktopMain()
|
|||
if (createComponent() < 0 )
|
||||
break;
|
||||
}
|
||||
|
||||
++timeoutCounter;
|
||||
if (timeoutCounter == INTERVAL_PROBES)
|
||||
{
|
||||
timeoutCounter = 0;
|
||||
sleep(MAINTENANCE_INTERVAL);
|
||||
}
|
||||
}
|
||||
|
||||
// Terminate child processes
|
||||
|
@ -1098,6 +1106,12 @@ int LOOLWSD::main(const std::vector<std::string>& args)
|
|||
else if (pid < 0)
|
||||
std::cout << Util::logPrefix() << "Child error: " << strerror(errno);
|
||||
|
||||
++timeoutCounter;
|
||||
if (timeoutCounter == INTERVAL_PROBES)
|
||||
{
|
||||
timeoutCounter = 0;
|
||||
sleep(MAINTENANCE_INTERVAL);
|
||||
}
|
||||
}
|
||||
|
||||
// Terminate child processes
|
||||
|
|
|
@ -31,6 +31,7 @@ public:
|
|||
// An Application is a singleton anyway, so just keep these as
|
||||
// statics
|
||||
static int portNumber;
|
||||
static int timeoutCounter;
|
||||
static std::string cache;
|
||||
static std::string sysTemplate;
|
||||
static std::string loTemplate;
|
||||
|
@ -41,7 +42,8 @@ public:
|
|||
|
||||
static const int DEFAULT_CLIENT_PORT_NUMBER = 9980;
|
||||
static const int MASTER_PORT_NUMBER = 9981;
|
||||
static const int FILE_PORT_NUMBER = 9979;
|
||||
static const int INTERVAL_PROBES = 10;
|
||||
static const int MAINTENANCE_INTERVAL = 1000000;
|
||||
static const std::string CHILD_URI;
|
||||
static const std::string PIDLOG;
|
||||
|
||||
|
|
Loading…
Reference in a new issue