• MySQLOO help. Crashing SRCDS
    31 replies, posted
[QUOTE=Drakehawke;39290393]Wrong way to do it, you're calling db:status() every time you run a query, this causes the main thread to wait until all running queries have finished before it pings the database. In short, when a lot of queries are running it's basically making it not threaded at all (i.e. lag) Also what the fuck [lua]function _Module:Query( ... ) local args = { ... }; local Query, Callback, Sync = args[1], args[2], args[3];[/lua] [lua]function _Module:Query( Query, Callback, Sync )[/lua] ?[/QUOTE] database:status() reconnects the database if the database was disconnected, unless you disable it. And I don't know why I did that, but I still do it. I probably shouldn't.
[QUOTE=zzaacckk;39291188]database:status() reconnects the database if the database was disconnected, unless you disable it.[/QUOTE] In the module, there's an SQL object which is needed to do anything involving the database, this can only be used by one thread at a time, so if you call status, it has to wait until all the other threads (i.e. running queries) have finished using it, causing srcds to freeze until that is done. You should wait for the query to actually fail before you reconnect/check status.
Sorry, you need to Log In to post a reply to this thread.