mirror of
https://github.com/haiwen/seahub.git
synced 2025-07-07 12:09:08 +00:00
Handle exception when calculate last modification time.
This commit is contained in:
parent
ada1436733
commit
faec2bc12f
@ -5,9 +5,11 @@ import re
|
|||||||
import stat
|
import stat
|
||||||
import urllib2
|
import urllib2
|
||||||
import uuid
|
import uuid
|
||||||
|
import logging
|
||||||
import json
|
import json
|
||||||
|
|
||||||
from django.contrib.sites.models import RequestSite
|
from django.contrib.sites.models import RequestSite
|
||||||
|
from django.db import IntegrityError
|
||||||
from django.shortcuts import render_to_response
|
from django.shortcuts import render_to_response
|
||||||
from django.template import RequestContext
|
from django.template import RequestContext
|
||||||
from django.utils.hashcompat import sha_constructor, md5_constructor
|
from django.utils.hashcompat import sha_constructor, md5_constructor
|
||||||
@ -34,6 +36,9 @@ except ImportError:
|
|||||||
|
|
||||||
import settings
|
import settings
|
||||||
|
|
||||||
|
# Get an instance of a logger
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
EMPTY_SHA1 = '0000000000000000000000000000000000000000'
|
EMPTY_SHA1 = '0000000000000000000000000000000000000000'
|
||||||
MAX_INT = 2147483647
|
MAX_INT = 2147483647
|
||||||
|
|
||||||
@ -655,7 +660,12 @@ def calc_dir_files_last_modified(repo_id, parent_dir, parent_dir_hash, dir_id):
|
|||||||
parent_dir_hash=parent_dir_hash,
|
parent_dir_hash=parent_dir_hash,
|
||||||
dir_id=dir_id,
|
dir_id=dir_id,
|
||||||
last_modified_info=json.dumps(last_modified_info))
|
last_modified_info=json.dumps(last_modified_info))
|
||||||
|
|
||||||
|
try:
|
||||||
info.save()
|
info.save()
|
||||||
|
except IntegrityError, e:
|
||||||
|
# If this record is already saved, skip this step.
|
||||||
|
logger.warn(e)
|
||||||
|
|
||||||
return last_modified_info
|
return last_modified_info
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user