mirror of https://gitlab.com/bashrc2/epicyon
Merge branch 'main' of ssh://code.freedombone.net:2222/bashrc/epicyon
commit
a525e7042e
|
|
@ -706,9 +706,9 @@ def brochModeLapses(baseDir: str, lapseDays=7) -> bool:
|
||||||
modifiedDate = \
|
modifiedDate = \
|
||||||
datetime.strptime(lastModified, "%Y-%m-%dT%H:%M:%SZ")
|
datetime.strptime(lastModified, "%Y-%m-%dT%H:%M:%SZ")
|
||||||
except BaseException:
|
except BaseException:
|
||||||
return brochMode
|
return False
|
||||||
if not modifiedDate:
|
if not modifiedDate:
|
||||||
return brochMode
|
return False
|
||||||
currTime = datetime.datetime.utcnow()
|
currTime = datetime.datetime.utcnow()
|
||||||
daysSinceBroch = (currTime - modifiedDate).days
|
daysSinceBroch = (currTime - modifiedDate).days
|
||||||
if daysSinceBroch >= lapseDays:
|
if daysSinceBroch >= lapseDays:
|
||||||
|
|
@ -717,6 +717,7 @@ def brochModeLapses(baseDir: str, lapseDays=7) -> bool:
|
||||||
brochMode = False
|
brochMode = False
|
||||||
setConfigParam(baseDir, "brochMode", brochMode)
|
setConfigParam(baseDir, "brochMode", brochMode)
|
||||||
print('Broch mode has elapsed')
|
print('Broch mode has elapsed')
|
||||||
|
return True
|
||||||
except BaseException:
|
except BaseException:
|
||||||
pass
|
pass
|
||||||
return brochMode
|
return False
|
||||||
|
|
|
||||||
7
inbox.py
7
inbox.py
|
|
@ -10,6 +10,7 @@ import json
|
||||||
import os
|
import os
|
||||||
import datetime
|
import datetime
|
||||||
import time
|
import time
|
||||||
|
import random
|
||||||
from linked_data_sig import verifyJsonSignature
|
from linked_data_sig import verifyJsonSignature
|
||||||
from utils import dmAllowedFromDomain
|
from utils import dmAllowedFromDomain
|
||||||
from utils import isRecentPost
|
from utils import isRecentPost
|
||||||
|
|
@ -2730,6 +2731,9 @@ def runInboxQueue(recentPostsCache: {}, maxRecentPosts: int,
|
||||||
# within _bounceDM
|
# within _bounceDM
|
||||||
lastBounceMessage = [int(time.time())]
|
lastBounceMessage = [int(time.time())]
|
||||||
|
|
||||||
|
# how long it takes for broch mode to lapse
|
||||||
|
brochLapseDays = random.randrange(7, 14)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
|
|
@ -2737,7 +2741,8 @@ def runInboxQueue(recentPostsCache: {}, maxRecentPosts: int,
|
||||||
heartBeatCtr += 1
|
heartBeatCtr += 1
|
||||||
if heartBeatCtr >= 10:
|
if heartBeatCtr >= 10:
|
||||||
# turn off broch mode after it has timed out
|
# turn off broch mode after it has timed out
|
||||||
brochModeLapses(baseDir)
|
if brochModeLapses(baseDir, brochLapseDays):
|
||||||
|
brochLapseDays = random.randrange(7, 14)
|
||||||
print('>>> Heartbeat Q:' + str(len(queue)) + ' ' +
|
print('>>> Heartbeat Q:' + str(len(queue)) + ' ' +
|
||||||
'{:%F %T}'.format(datetime.datetime.now()))
|
'{:%F %T}'.format(datetime.datetime.now()))
|
||||||
heartBeatCtr = 0
|
heartBeatCtr = 0
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue