[Libreoffice-commits] online.git: loolwsd/AdminModel.hpp
Pranav Kant
pranavk at collabora.com
Fri Mar 25 14:40:51 UTC 2016
loolwsd/AdminModel.hpp | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
New commits:
commit aa391888d5e3e8d64632998ee40cfc3efc9ae134
Author: Pranav Kant <pranavk at collabora.com>
Date: Fri Mar 25 20:06:48 2016 +0530
loolwsd: Remove the AdminModel document after expired
The plan was to keep the document's open and close history right
from the moment the server started up to the end, so we would
only expire() the document. For now, just destroy the document
as soon as user session is closed.
Change-Id: Id8f5b550a2b9bda217f7f8f8f1f82f85b1aa3502
diff --git a/loolwsd/AdminModel.hpp b/loolwsd/AdminModel.hpp
index 1ab242d..af38c6d 100644
--- a/loolwsd/AdminModel.hpp
+++ b/loolwsd/AdminModel.hpp
@@ -264,7 +264,7 @@ public:
}
else if (tokens[0] == "active_docs_count")
{
- return std::to_string(_nActiveDocuments);
+ return std::to_string(_documents.size());
}
else if (tokens[0] == "mem_stats")
{
@@ -415,8 +415,6 @@ public:
}
private:
- // FIXME: we have a problem if new document to be added has PID = expired document in the map
- // Prolly, *move* expired documents to another container (?)
void addDocument(Poco::Process::PID pid, std::string url)
{
const auto ret = _documents.emplace(pid, Document(pid, url));
@@ -424,10 +422,6 @@ private:
{
Log::warn() << "Document with PID [" + std::to_string(pid) + "] already exists." << Log::end;
}
- else
- {
- _nActiveDocuments++;
- }
}
void removeDocument(Poco::Process::PID pid)
@@ -435,8 +429,11 @@ private:
auto it = _documents.find(pid);
if (it != _documents.end() && !it->second.isExpired())
{
+ // TODO: The idea is to only expire the document and keep the history
+ // of documents open and close, to be able to give a detailed summary
+ // to the admin console with views. For now, just remove the document.
it->second.expire();
- _nActiveDocuments--;
+ _documents.erase(it);
}
}
@@ -507,9 +504,6 @@ private:
std::list<unsigned> _cpuStats;
unsigned _cpuStatsSize = 100;
-
- /// Number of active documents
- unsigned _nActiveDocuments = 0;
};
#endif
More information about the Libreoffice-commits
mailing list