def increment_completed_dynamo(info_hash):
"""
Atomic increment completed for a torrent.
"""
ensure_torrent_exists(info_hash)
# Update the torrents list with the new information
result = table.update_item(
Key={
'info_hash': info_hash,
},
UpdateExpression="SET completed = completed + :incr",
ExpressionAttributeValues={
':incr': 1,
},
ReturnValues="UPDATED_NEW"
)
if result['ResponseMetadata']['HTTPStatusCode'] == 200 and 'Attributes' in result:
return True
return False
评论列表
文章目录