cedbv / SiriServer

Ce projet a pour but de recréer un serveur pour Siri en python.
5 stars 2 forks source link

Suggestion and nice job #1

Open jimmykane opened 12 years ago

jimmykane commented 12 years ago

In your code I think that you create a connection to the sqlite connection for each device (inbound connection) This (either using epoll or not ) creates a big table of descriptors for the db connection, thus killing the process (its a matter of time and system resources).

remove the instace variables from the functions (self.dbconnection) and declare it as a global in :

class SiriServer(asyncore.dispatcher):

def init(self, host, port): global dbConnection dbConnection = db.getConnection()

Look if you like at my fork.

I would be much interested to contribute to one fork and not have many forks because all these forks etc make this confusing.

Anyway i can help!

jimmykane commented 12 years ago

Hehe and because i have forked Eichhoernchen SiriProxy I cant fork yours! In order to make a pull request.

Maybe we could work on one version on this. Contact me for anything or suggestions

cedbv commented 12 years ago

Yeah, using the poll was just the first step. I was planning to use a sort of singleton for dbConnection later.

A fork of a fork <- That would be really confusing too ^^.

I see your message on IRC too. I'm going to sleep now and writing in real time in English is a bit difficult for me.

One version of what. SiriServer or just the db part ? Most of my changes (except the mysql part and the firstName) are just to add French and some plugins, so it would not be really difficult anyway but I don't know if it's interresting for other people than me.

jimmykane commented 12 years ago

Singleton is good but also useless if only one connection to the db is made! So eg move the dbConnection as a global in the init (Should only create one connection) and then always refer to that connection This will also make the sqlite version not to crash by many requestlocks on the same sqlite file