added collect_backend admininterface command + collecting one backend every 2 hours
This commit is contained in:
parent
e733ee38fb
commit
ad49c6f567
4 changed files with 9 additions and 4 deletions
|
@ -217,7 +217,7 @@ class SpectrumNetworkPlugin : public NetworkPlugin {
|
|||
|
||||
purple_account_set_password(account, password.c_str());
|
||||
purple_account_set_enabled(account, "spectrum", TRUE);
|
||||
purple_account_set_bool(account, "custom_smileys", FALSE));
|
||||
purple_account_set_bool(account, "custom_smileys", FALSE);
|
||||
|
||||
const PurpleStatusType *status_type = purple_account_get_status_type_with_primitive(account, PURPLE_STATUS_AVAILABLE);
|
||||
if (status_type != NULL) {
|
||||
|
|
|
@ -66,6 +66,8 @@ class NetworkPluginServer {
|
|||
return m_clients;
|
||||
}
|
||||
|
||||
void collectBackend();
|
||||
|
||||
void handleMessageReceived(NetworkConversation *conv, boost::shared_ptr<Swift::Message> &message);
|
||||
|
||||
private:
|
||||
|
@ -104,7 +106,6 @@ class NetworkPluginServer {
|
|||
void send(boost::shared_ptr<Swift::Connection> &, const std::string &data);
|
||||
|
||||
void pingTimeout();
|
||||
void collectBackend();
|
||||
void sendPing(Backend *c);
|
||||
Backend *getFreeClient();
|
||||
|
||||
|
|
|
@ -237,6 +237,9 @@ void AdminInterface::handleMessageReceived(Swift::Message::ref message) {
|
|||
|
||||
message->setBody(lst);
|
||||
}
|
||||
else if (message->getBody() == "collect_backend") {
|
||||
m_server->collectBackend();
|
||||
}
|
||||
else if (message->getBody().find("help") == 0) {
|
||||
std::string help;
|
||||
help += "General:\n";
|
||||
|
|
|
@ -146,7 +146,7 @@ NetworkPluginServer::NetworkPluginServer(Component *component, Config *config, U
|
|||
m_pingTimer->onTick.connect(boost::bind(&NetworkPluginServer::pingTimeout, this));
|
||||
m_pingTimer->start();
|
||||
|
||||
m_collectTimer = component->getNetworkFactories()->getTimerFactory()->createTimer(3600000);
|
||||
m_collectTimer = component->getNetworkFactories()->getTimerFactory()->createTimer(2*3600000);
|
||||
m_collectTimer->onTick.connect(boost::bind(&NetworkPluginServer::collectBackend, this));
|
||||
m_collectTimer->start();
|
||||
|
||||
|
@ -601,6 +601,7 @@ void NetworkPluginServer::collectBackend() {
|
|||
}
|
||||
|
||||
if (backend) {
|
||||
m_collectTimer->start();
|
||||
LOG4CXX_INFO(logger, "Backend " << backend << "is set to die");
|
||||
backend->acceptUsers = false;
|
||||
}
|
||||
|
@ -962,7 +963,7 @@ void NetworkPluginServer::sendPing(Backend *c) {
|
|||
|
||||
NetworkPluginServer::Backend *NetworkPluginServer::getFreeClient() {
|
||||
NetworkPluginServer::Backend *c = NULL;
|
||||
bool spawnNew = false;
|
||||
// bool spawnNew = false;
|
||||
for (std::list<Backend *>::const_iterator it = m_clients.begin(); it != m_clients.end(); it++) {
|
||||
// This backend is free.
|
||||
if ((*it)->acceptUsers && (*it)->users.size() < CONFIG_INT(m_config, "service.users_per_backend") && (*it)->connection) {
|
||||
|
|
Loading…
Add table
Reference in a new issue