mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-13 14:44:29 -04:00
remove atomic transactions
This commit is contained in:
parent
844b5c5e20
commit
1cabde3ccd
1 changed files with 27 additions and 19 deletions
|
@ -23,9 +23,11 @@ def parse_sql_main_index(out_dir: Path=OUTPUT_DIR) -> Iterator[Link]:
|
|||
)
|
||||
|
||||
@enforce_types
|
||||
def remove_from_sql_main_index(snapshots: QuerySet, out_dir: Path=OUTPUT_DIR) -> None:
|
||||
def remove_from_sql_main_index(snapshots: QuerySet, atomic: bool=False, out_dir: Path=OUTPUT_DIR) -> None:
|
||||
if atomic:
|
||||
with transaction.atomic():
|
||||
snapshots.delete()
|
||||
return snapshots.delete()
|
||||
return snapshots.delete()
|
||||
|
||||
@enforce_types
|
||||
def write_link_to_sql_index(link: Link):
|
||||
|
@ -80,8 +82,9 @@ def write_link_to_sql_index(link: Link):
|
|||
|
||||
@enforce_types
|
||||
def write_sql_main_index(links: List[Link], out_dir: Path=OUTPUT_DIR) -> None:
|
||||
with transaction.atomic():
|
||||
for link in links:
|
||||
# with transaction.atomic():
|
||||
# write_link_to_sql_index(link)
|
||||
write_link_to_sql_index(link)
|
||||
|
||||
|
||||
|
@ -89,7 +92,12 @@ def write_sql_main_index(links: List[Link], out_dir: Path=OUTPUT_DIR) -> None:
|
|||
def write_sql_link_details(link: Link, out_dir: Path=OUTPUT_DIR) -> None:
|
||||
from core.models import Snapshot
|
||||
|
||||
with transaction.atomic():
|
||||
# with transaction.atomic():
|
||||
# try:
|
||||
# snap = Snapshot.objects.get(url=link.url)
|
||||
# except Snapshot.DoesNotExist:
|
||||
# snap = write_link_to_sql_index(link)
|
||||
# snap.title = link.title
|
||||
try:
|
||||
snap = Snapshot.objects.get(url=link.url)
|
||||
except Snapshot.DoesNotExist:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue