mirror of
https://gitlab.com/SIGBUS/nyaa.git
synced 2024-12-22 20:10:00 +00:00
fix race condition?
This commit is contained in:
parent
ba7e0a7c2e
commit
1b76eaea35
|
@ -240,11 +240,10 @@ def ghetto_import():
|
||||||
if not tracker:
|
if not tracker:
|
||||||
tracker = models.Trackers(uri=announce)
|
tracker = models.Trackers(uri=announce)
|
||||||
db.session.add(tracker)
|
db.session.add(tracker)
|
||||||
|
db.session.flush()
|
||||||
|
|
||||||
db_trackers.add(tracker)
|
db_trackers.add(tracker)
|
||||||
|
|
||||||
db.session.flush()
|
|
||||||
|
|
||||||
# Store tracker refs in DB
|
# Store tracker refs in DB
|
||||||
for order, tracker in enumerate(db_trackers):
|
for order, tracker in enumerate(db_trackers):
|
||||||
torrent_tracker = models.TorrentTrackers(torrent_id=torrent.id,
|
torrent_tracker = models.TorrentTrackers(torrent_id=torrent.id,
|
||||||
|
|
|
@ -139,11 +139,10 @@ def handle_torrent_upload(upload_form, uploading_user=None, fromAPI=False):
|
||||||
if not tracker:
|
if not tracker:
|
||||||
tracker = models.Trackers(uri=announce)
|
tracker = models.Trackers(uri=announce)
|
||||||
db.session.add(tracker)
|
db.session.add(tracker)
|
||||||
|
db.session.flush()
|
||||||
|
|
||||||
db_trackers.add(tracker)
|
db_trackers.add(tracker)
|
||||||
|
|
||||||
db.session.flush()
|
|
||||||
|
|
||||||
# Store tracker refs in DB
|
# Store tracker refs in DB
|
||||||
for order, tracker in enumerate(db_trackers):
|
for order, tracker in enumerate(db_trackers):
|
||||||
torrent_tracker = models.TorrentTrackers(torrent_id=torrent.id,
|
torrent_tracker = models.TorrentTrackers(torrent_id=torrent.id,
|
||||||
|
|
Loading…
Reference in a new issue