[storm] closing connections
Jason Novotny
jason.novotny at gmail.com
Tue Apr 22 23:19:36 UTC 2014
Hi,
I'm fairly new to Python and Storm and seeing some problems on my MySQL
database-- I get
"SQL Error 1040: Too Many Connection"
I'm trying to wrap Storm in a class called Repository that is so far
pretty simple:
class Repository(object):
def __init__(self, url):
database = create_database(url)
self.store = Store(database)
def update(self, domain):
self.store.add(domain)
self.store.commit()
def findById(self, klasses, id):
conds = [k.id == id for k in klasses]
result = self.store.find(tuple(klasses), *conds)
klass_dict = dict((r.__class__, r) for r in result.one())
return klass_dict
But I'm wondering where is the best place in the application to close a
connection, can I use a destructor or something? Note, I'm not building
a webapp, in fact I'm just writing python "tasks" that will execute and
complete before another task gets launched so looks like closing any db
connections is pretty critical.
Thanks, Jason
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/storm/attachments/20140422/c0c792e4/attachment.html>
More information about the storm
mailing list