mirror of
https://github.com/HelloZeroNet/ZeroNet.git
synced 2023-12-14 04:33:03 +01:00
Batch onion update
This commit is contained in:
parent
37ef2802de
commit
32a0f96ecd
1 changed files with 11 additions and 3 deletions
|
@ -46,16 +46,24 @@ class FileRequestPlugin(object):
|
|||
|
||||
s = time.time()
|
||||
# Separatley add onions to sites or at once if no onions present
|
||||
hashes_changed = 0
|
||||
i = 0
|
||||
onion_to_hash = {}
|
||||
for onion in params.get("onions", []):
|
||||
if onion not in onion_to_hash:
|
||||
onion_to_hash[onion] = []
|
||||
onion_to_hash[onion].append(hashes[i])
|
||||
i += 1
|
||||
|
||||
hashes_changed = 0
|
||||
db.execute("BEGIN")
|
||||
for onion, onion_hashes in onion_to_hash.iteritems():
|
||||
hashes_changed += db.peerAnnounce(
|
||||
onion=onion,
|
||||
port=params["port"],
|
||||
hashes=[hashes[i]],
|
||||
hashes=onion_hashes,
|
||||
onion_signed=all_onions_signed
|
||||
)
|
||||
i += 1
|
||||
db.execute("END")
|
||||
time_db_onion = time.time() - s
|
||||
|
||||
s = time.time()
|
||||
|
|
Loading…
Reference in a new issue