forked from indymedia/epicyon
Replace exponential backoff with regular retries
parent
0088ae2aac
commit
ef7135cd98
9
posts.py
9
posts.py
|
@ -1006,10 +1006,10 @@ def createReportPost(baseDir: str,
|
||||||
def threadSendPost(session,postJsonStr: str,federationList: [],\
|
def threadSendPost(session,postJsonStr: str,federationList: [],\
|
||||||
inboxUrl: str, baseDir: str,signatureHeaderJson: {},postLog: [],
|
inboxUrl: str, baseDir: str,signatureHeaderJson: {},postLog: [],
|
||||||
debug :bool) -> None:
|
debug :bool) -> None:
|
||||||
"""Sends a post with exponential backoff
|
"""Sends a with retries
|
||||||
"""
|
"""
|
||||||
tries=0
|
tries=0
|
||||||
backoffTime=60
|
sendIntervalSec=30
|
||||||
for attempt in range(20):
|
for attempt in range(20):
|
||||||
postResult=None
|
postResult=None
|
||||||
try:
|
try:
|
||||||
|
@ -1043,9 +1043,8 @@ def threadSendPost(session,postJsonStr: str,federationList: [],\
|
||||||
if debug:
|
if debug:
|
||||||
print(postJsonStr)
|
print(postJsonStr)
|
||||||
print('DEBUG: json post to '+inboxUrl+' failed. Waiting for '+ \
|
print('DEBUG: json post to '+inboxUrl+' failed. Waiting for '+ \
|
||||||
str(backoffTime)+' seconds.')
|
str(sendIntervalSec)+' seconds.')
|
||||||
time.sleep(backoffTime)
|
time.sleep(sendIntervalSec)
|
||||||
backoffTime *= 2
|
|
||||||
tries+=1
|
tries+=1
|
||||||
|
|
||||||
def sendPost(projectVersion: str, \
|
def sendPost(projectVersion: str, \
|
||||||
|
|
Loading…
Reference in New Issue