bugfix: subscribe as default if not subscribed yet, when posting to a tag
This commit is contained in:
parent
3c76544afb
commit
3ac89d301c
|
@ -611,6 +611,7 @@ launchWorkerThreads serv = concurrently_
|
||||||
(fetchTagPosts serv)
|
(fetchTagPosts serv)
|
||||||
(relayWorker serv)
|
(relayWorker serv)
|
||||||
|
|
||||||
|
|
||||||
-- | process the pending relay inbox of incoming posts from the internal queue:
|
-- | process the pending relay inbox of incoming posts from the internal queue:
|
||||||
-- Look up responsible relay node for given hashtag and forward post to it
|
-- Look up responsible relay node for given hashtag and forward post to it
|
||||||
processIncomingPosts :: DHT d => PostService d -> IO ()
|
processIncomingPosts :: DHT d => PostService d -> IO ()
|
||||||
|
@ -642,7 +643,7 @@ processIncomingPosts serv = forever $ do
|
||||||
now <- getPOSIXTime
|
now <- getPOSIXTime
|
||||||
subscriptionStatus <- HMap.lookup (hashtagToId tag) <$> readTVarIO (ownSubscriptions serv)
|
subscriptionStatus <- HMap.lookup (hashtagToId tag) <$> readTVarIO (ownSubscriptions serv)
|
||||||
-- if not yet subscribed or subscription expires within 2 minutes, (re)subscribe to tag
|
-- if not yet subscribed or subscription expires within 2 minutes, (re)subscribe to tag
|
||||||
when (maybe False (\subLease -> now - subLease < 120) subscriptionStatus) $
|
when (maybe True (\subLease -> now - subLease < 120) subscriptionStatus) $
|
||||||
void $ clientSubscribeTo serv tag
|
void $ clientSubscribeTo serv tag
|
||||||
|
|
||||||
-- for evaluation, return the tag of the successfully forwarded post
|
-- for evaluation, return the tag of the successfully forwarded post
|
||||||
|
|
Loading…
Reference in a new issue