[CalendarServer-changes] [6511] CalendarServer/branches/users/glyph/sharedpool/calendarserver/tap/ util.py
source_changes at macosforge.org
source_changes at macosforge.org
Mon Nov 1 14:18:00 PDT 2010
Revision: 6511
http://trac.macosforge.org/projects/calendarserver/changeset/6511
Author: glyph at apple.com
Date: 2010-11-01 14:17:57 -0700 (Mon, 01 Nov 2010)
Log Message:
-----------
Use a local connection pool
Modified Paths:
--------------
CalendarServer/branches/users/glyph/sharedpool/calendarserver/tap/util.py
Modified: CalendarServer/branches/users/glyph/sharedpool/calendarserver/tap/util.py
===================================================================
--- CalendarServer/branches/users/glyph/sharedpool/calendarserver/tap/util.py 2010-11-01 21:17:34 UTC (rev 6510)
+++ CalendarServer/branches/users/glyph/sharedpool/calendarserver/tap/util.py 2010-11-01 21:17:57 UTC (rev 6511)
@@ -61,6 +61,7 @@
NegotiateCredentialFactory # pacify pyflakes
except ImportError:
NegotiateCredentialFactory = None
+from txdav.base.datastore.asyncsqlpool import ConnectionPool
from calendarserver.accesslog import DirectoryLogWrapperResource
from calendarserver.provision.root import RootResource
@@ -84,6 +85,9 @@
"""
if config.UseDatabase:
dbRoot = CachingFilePath(config.DatabaseRoot)
+
+ # Construct a PostgresService exactly as the parent would, so that we
+ # can establish connection information.
postgresService = PostgresService(
dbRoot, None, v1_schema,
databaseName=config.Postgres.DatabaseName,
@@ -94,9 +98,17 @@
maxConnections=config.Postgres.MaxConnections,
options=config.Postgres.Options,
)
- return CommonSQLDataStore(postgresService.produceLocalTransaction,
+
+ cp = ConnectionPool(postgresService.produceConnection)
+ cp.setServiceParent(serviceParent)
+
+ dataStore = CommonSQLDataStore(
+ cp.connection,
notifierFactory, dbRoot.child("attachments"),
- config.EnableCalDAV, config.EnableCardDAV)
+ config.EnableCalDAV, config.EnableCardDAV
+ )
+ dataStore.setServiceParent(serviceParent)
+ return dataStore
else:
return CommonFileDataStore(FilePath(config.DocumentRoot),
notifierFactory, config.EnableCalDAV, config.EnableCardDAV)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20101101/519159ff/attachment-0001.html>
More information about the calendarserver-changes
mailing list