X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=daklib%2Fdbconn.py;h=3806e31e2d09c9922c58014e9c0462d13e0a368b;hb=504b5a17d6b16ecfc7aea32e4a1e92658db829fe;hp=24f8fb17d9620f99570db40e203ac21381ec142c;hpb=4bc88b4276c5b8cf2b03f24c81f19c90e8e12265;p=dak.git diff --git a/daklib/dbconn.py b/daklib/dbconn.py index 24f8fb17..3806e31e 100755 --- a/daklib/dbconn.py +++ b/daklib/dbconn.py @@ -512,9 +512,8 @@ class DBBinary(ORMObject): iso8859-1 encoding. ''' fullpath = self.poolfile.fullpath - debdata = Popen(['dpkg-deb', '--fsys-tarfile', fullpath], - stdout = PIPE).stdout - tar = TarFile.open(fileobj = debdata, mode = 'r|') + dpkg = Popen(['dpkg-deb', '--fsys-tarfile', fullpath], stdout = PIPE) + tar = TarFile.open(fileobj = dpkg.stdout, mode = 'r|') for member in tar.getmembers(): if member.isfile(): try: @@ -523,7 +522,8 @@ class DBBinary(ORMObject): name = member.name.decode('iso8859-1') yield normpath(name) tar.close() - debdata.close() + dpkg.stdout.close() + dpkg.wait() __all__.append('DBBinary') @@ -3288,7 +3288,7 @@ class DBConn(object): mapper(BinContents, self.tbl_bin_contents, properties = dict( binary = relation(DBBinary, - backref=backref('contents', lazy='dynamic')), + backref=backref('contents', lazy='dynamic', cascade='all')), file = self.tbl_bin_contents.c.file)) ## Connection functions @@ -3306,8 +3306,14 @@ class DBConn(object): connstr = "postgres:///%s" % cnf["DB::Name"] if cnf["DB::Port"] and cnf["DB::Port"] != "-1": connstr += "?port=%s" % cnf["DB::Port"] - - self.db_pg = create_engine(connstr, echo=self.debug) + if not cnf.has_key('DB::PoolSize'): + cnf['DB::PoolSize'] = '5' + if not cnf.has_key('DB::MaxOverflow'): + cnf['DB::MaxOverflow'] = '10' + + self.db_pg = create_engine(connstr, echo=self.debug, + pool_size=int(cnf['DB::PoolSize']), + max_overflow=int(cnf['DB::MaxOverflow'])) self.db_meta = MetaData() self.db_meta.bind = self.db_pg self.db_smaker = sessionmaker(bind=self.db_pg,