mirror of
https://github.com/ajurna/cbwebreader.git
synced 2025-12-06 06:17:17 +00:00
added atomic commiting to processing comic books to increase performance.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
from django.db import models
|
||||
from django.db.transaction import atomic
|
||||
from django.utils.http import urlsafe_base64_encode, urlsafe_base64_decode
|
||||
from django.contrib.auth.models import User
|
||||
|
||||
@@ -18,6 +19,7 @@ class Setting(models.Model):
|
||||
def __unicode__(self):
|
||||
return self.__str__()
|
||||
|
||||
|
||||
class ComicBook(models.Model):
|
||||
file_name = models.CharField(max_length=100, unique=True)
|
||||
|
||||
@@ -129,7 +131,7 @@ class ComicBook(models.Model):
|
||||
cbx = zipfile.ZipFile(path.join(base_dir, comic_path))
|
||||
except zipfile.BadZipfile:
|
||||
return False
|
||||
|
||||
with atomic():
|
||||
book = ComicBook(file_name=comic_file_name)
|
||||
book.save()
|
||||
i = 0
|
||||
|
||||
@@ -3,8 +3,6 @@ from django.template import RequestContext
|
||||
from django.utils.http import urlsafe_base64_decode
|
||||
from django.shortcuts import render, redirect, get_object_or_404
|
||||
from django.contrib.auth.decorators import login_required, user_passes_test
|
||||
from django.core.validators import validate_email
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.contrib.auth.models import User
|
||||
|
||||
from comic.models import Setting, ComicBook, ComicStatus
|
||||
|
||||
Reference in New Issue
Block a user