diff --git a/kit/Kit.cpp b/kit/Kit.cpp index 26270eac99654..f82d4f405eb1f 100644 --- a/kit/Kit.cpp +++ b/kit/Kit.cpp @@ -2446,8 +2446,7 @@ void Document::drainQueue() } } - if (processInputEnabled() && !isLoadOngoing() && - !isBackgroundSaveProcess() && _queue->getTileQueueSize() > 0) + if (canRenderTiles()) { std::vector tileRequests = _queue->popWholeTileQueue(); diff --git a/kit/Kit.hpp b/kit/Kit.hpp index 6f36e3581fece..b5f6497b5f95d 100644 --- a/kit/Kit.hpp +++ b/kit/Kit.hpp @@ -336,6 +336,11 @@ class Document final : public std::enable_shared_from_this /// A new message from wsd for the queue void queueMessage(const std::string &msg) { _queue->put(msg); } bool hasQueueItems() const { return _queue && !_queue->isEmpty(); } + bool canRenderTiles() const { + return processInputEnabled() && !isLoadOngoing() && + !isBackgroundSaveProcess() && _queue && + _queue->getTileQueueSize() > 0; + } bool hasCallbacks() const { return _queue && _queue->callbackSize() > 0; } /// Should we get through the SocketPoll fast to process queus ? @@ -343,7 +348,10 @@ class Document final : public std::enable_shared_from_this { if (hasCallbacks()) return true; - if (hasQueueItems() && processInputEnabled()) + // not processing input messages or tile renders + if (!processInputEnabled()) + return false; + if (hasQueueItems() || canRenderTiles()) return true; return false; } diff --git a/kit/KitQueue.hpp b/kit/KitQueue.hpp index 1177aae3ab8eb..10a9596227bfd 100644 --- a/kit/KitQueue.hpp +++ b/kit/KitQueue.hpp @@ -191,13 +191,13 @@ class KitQueue int priority(const TileDesc &desc); private: - /// The incoming underlying queue + /// Queue of incoming messages from coolwsd std::vector _queue; - /// Incoming tile request queue + /// Queue of incoming tile requests from coolwsd std::vector _tileQueue; - /// Outgoing queued callbacks + /// Queue of callbacks from Kit to send out to coolwsd std::vector _callbacks; std::map _cursorPositions;