in backend/lambda/vote-stream/lambda.py [0:0]
def updateQuestionVoteCounts(questionVoteDeltaMap):
with ThreadPoolExecutor(max_workers=50) as executor:
allUpdateFutures = []
for questionId, cv in questionVoteDeltaMap.items():
print('cv', cv)
allUpdateFutures.append(
executor.submit(
updateQuestionVoteCount,
questionId,
cv['channelArn'],
cv['voteDelta']
)
)
for future in as_completed(allUpdateFutures):
try :
# To surface any exceptions
future.result()
except Exception as e:
print(e)