Commit 9dc1e6edefaf3b7625da3b11f13c1186a6fda36f
1 parent
b615099f
Publish retained messages out of subscriptions lock
When clients connect, they get the retained messages. There is no need to do that while holding the subscriptions lock.
Showing
1 changed file
with
1 additions
and
2 deletions
subscriptionstore.cpp
| @@ -144,12 +144,11 @@ void SubscriptionStore::addSubscription(std::shared_ptr<Client> &client, const s | @@ -144,12 +144,11 @@ void SubscriptionStore::addSubscription(std::shared_ptr<Client> &client, const s | ||
| 144 | { | 144 | { |
| 145 | const std::shared_ptr<Session> &ses = session_it->second; | 145 | const std::shared_ptr<Session> &ses = session_it->second; |
| 146 | deepestNode->addSubscriber(ses, qos); | 146 | deepestNode->addSubscriber(ses, qos); |
| 147 | + lock_guard.unlock(); | ||
| 147 | uint64_t count = giveClientRetainedMessages(ses, subtopics, qos); | 148 | uint64_t count = giveClientRetainedMessages(ses, subtopics, qos); |
| 148 | client->getThreadData()->incrementSentMessageCount(count); | 149 | client->getThreadData()->incrementSentMessageCount(count); |
| 149 | } | 150 | } |
| 150 | } | 151 | } |
| 151 | - | ||
| 152 | - lock_guard.unlock(); | ||
| 153 | } | 152 | } |
| 154 | 153 | ||
| 155 | void SubscriptionStore::removeSubscription(std::shared_ptr<Client> &client, const std::string &topic) | 154 | void SubscriptionStore::removeSubscription(std::shared_ptr<Client> &client, const std::string &topic) |