mirror of
https://github.com/postgres/pgweb.git
synced 2025-08-06 09:57:57 +00:00
Ensure db connection is closed before script exits
This is required in django 1.4, but was closed automatically back in 1.2 when it was created.
This commit is contained in:
@ -13,7 +13,7 @@ import settings
|
|||||||
setup_environ(settings)
|
setup_environ(settings)
|
||||||
|
|
||||||
from core.models import ImportedRSSFeed, ImportedRSSItem
|
from core.models import ImportedRSSFeed, ImportedRSSItem
|
||||||
from django.db import transaction
|
from django.db import transaction, connection
|
||||||
|
|
||||||
# Set timeout for loading RSS feeds
|
# Set timeout for loading RSS feeds
|
||||||
socket.setdefaulttimeout(20)
|
socket.setdefaulttimeout(20)
|
||||||
@ -49,3 +49,5 @@ for importfeed in ImportedRSSFeed.objects.all():
|
|||||||
transaction.commit()
|
transaction.commit()
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
print "Failed to load %s: %s" % (importfeed, e)
|
print "Failed to load %s: %s" % (importfeed, e)
|
||||||
|
|
||||||
|
connection.close()
|
||||||
|
Reference in New Issue
Block a user