Skip to content

Commit 874e3b7

Browse files
authored
make retry/recovery optional on first subscriptions (#48218)
1 parent e43e89a commit 874e3b7

File tree

4 files changed

+9
-1
lines changed

4 files changed

+9
-1
lines changed

examples/config/pushpin.conf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,9 @@ message_wait=5000
157157
# time (seconds) to cache message ids
158158
id_cache_ttl=60
159159

160+
# retry/recover sessions soon after the first subscription to a channel
161+
update_on_first_subscription=true
162+
160163
# max subscriptions per connection
161164
connection_subscription_max=20
162165

src/handler/handlerapp.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@ class HandlerApp::Private
314314
int messageBlockSize = settings.value("handler/message_block_size", -1).toInt();
315315
int messageWait = settings.value("handler/message_wait", 5000).toInt();
316316
int idCacheTtl = settings.value("handler/id_cache_ttl", 0).toInt();
317+
bool updateOnFirstSubscription = settings.value("handler/update_on_first_subscription", true).toBool();
317318
int clientMaxconn = settings.value("runner/client_maxconn", 50000).toInt();
318319
int connectionSubscriptionMax = settings.value("handler/connection_subscription_max", 20).toInt();
319320
int subscriptionLinger = settings.value("handler/subscription_linger", 60).toInt();
@@ -378,6 +379,7 @@ class HandlerApp::Private
378379
config.messageBlockSize = messageBlockSize;
379380
config.messageWait = messageWait;
380381
config.idCacheTtl = idCacheTtl;
382+
config.updateOnFirstSubscription = updateOnFirstSubscription;
381383
config.connectionsMax = clientMaxconn;
382384
config.connectionSubscriptionMax = connectionSubscriptionMax;
383385
config.subscriptionLinger = subscriptionLinger;

src/handler/handlerengine.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2316,7 +2316,8 @@ class HandlerEngine::Private
23162316

23172317
void sub_subscribed(Subscription *sub)
23182318
{
2319-
updateSessions(sub->channel());
2319+
if(config.updateOnFirstSubscription)
2320+
updateSessions(sub->channel());
23202321
}
23212322

23222323
void acceptWorker_sessionsReady(AcceptWorker *w)

src/handler/handlerengine.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ class HandlerEngine
7575
int messageBlockSize;
7676
int messageWait;
7777
int idCacheTtl;
78+
bool updateOnFirstSubscription;
7879
int connectionsMax;
7980
int connectionSubscriptionMax;
8081
int subscriptionLinger;
@@ -98,6 +99,7 @@ class HandlerEngine
9899
messageBlockSize(-1),
99100
messageWait(-1),
100101
idCacheTtl(-1),
102+
updateOnFirstSubscription(false),
101103
connectionsMax(-1),
102104
connectionSubscriptionMax(-1),
103105
subscriptionLinger(-1),

0 commit comments

Comments
 (0)