dominikh changed the topic of #cinch to: The IRC Framework | Latest version: Cinch 2.2.4
djbkd has joined #cinch
ktulu has joined #cinch
<ktulu> Hey quick quesiton hopefully. How does cinch do its threading? I'm doing some code using a MySQL database and I'm having some issues.
<dominikh> ktulu: what kind of answer do you expect when asking "How?"
<dominikh> each handler invocation goes in its own thread
<dominikh> all handlers for the same plugin are in a thread group
<ktulu> thats what I needed
<ktulu> i'm running into 'connection in use' issues is all.
<dominikh> ah.
<ktulu> yeah
<ktulu> I give ach of the 2 plugins that use a db their on connecitons of course...
<ktulu> *own
* ktulu sighs
<ktulu> oddly. it only happens in the live channel not my dev channel
<dominikh> I have no idea how popular Ruby ORMs/DB libs do their connection stuff nowadays, but the sensible option would be a global connection pool with an upper limit. ask for a connection and there's none available and it should block and wait until one is freed
<dominikh> I'd hope that a sensible DB pool works like that
<ktulu> its a wrapper for mysql2 that allows prepared statements
<ktulu> so mysql2 basically
<ktulu> perhaps if it uses a global pool then I should just create the connection in the main thread and pass the reference to the plugins.
<ktulu> but the reason I didnt do that is I figured doing so would create the exact issue I have
<ktulu> its weird since the other plugin runs fine, but the new one has issues when I wne t and had each fucntion create and close the connecitons as needed.
<dominikh> sorry, I can't really say much about this. in the past I've only used libraries that handled this correctly under the hood (sequel, datamapper, just using the plain sqlite lib, etc)
<dominikh> and I've been out of the loop for years now
<dominikh> also, one has to differentiate between an actual connection to the database, and an abstract connection that really is a transparent pool of connections
<dominikh> a single MySQL connection can only be used by a single query at a time, for example
<ktulu> right
<ktulu> mysql2 is supposed to be threadsafe too..dammit
<dominikh> maybe you're doing it wrong ;)
<ktulu> apparently so
<dominikh> also, if you have a pool of connections, and say the limit is 1, and you're currently using a connection, iterating over a row pointer, and you try to kick off another query while still using that connection, you can't. that one connection is in use, you can't open a second one, and you will never release the first one as it's deadlocked. but again, that's assuming a particular pool implementation, and I have
<dominikh> no idea how ruby libs do things
<ktulu> see I even tried giving each function its own con
<ktulu> open work close
<ktulu> so somehow I think the first plugin's cons are affecting it
<ktulu> k
<ktulu> damn connection is weird
<ktulu> fucking bar wifi
<dominikh> don't people go to bars to drink, not to debug code? :P
<ktulu> iI am drinking
<ktulu> I just cant code and drink at work!
<dominikh> drinking and coding doesn't seem to work out too well for you today ;)
<ktulu> lord knows C/AL will drive a man to it
<dominikh> so maybe work has figured it out
<ktulu> hah
<ktulu> im not even buzzed
<ktulu> ah right
<ktulu> may have fixed that
<ktulu> other issue is in the live chan (wher eI load all plugins) the memo plugin does not even fire on its match
<dominikh> does it work in… other channels?
<ktulu> if its the only one loaded yes
<dominikh> you're doing some weird things.
<ktulu> eh would code help
<ktulu> ?
<dominikh> more than vague proble descriptions? yes.
<ktulu> had to scp it back
<ktulu> im also newish to ruby so heh
<dominikh> unrelated, but [^\s] is just \S
<dominikh> line 15 is useless
<ktulu> indeed
<ktulu> this has been doen during freetie at work and at home late night heh
<dominikh> as for the rest, check your logs if they say anything interesting. order in which you load plugins shouldn't generally matter
<dominikh> unless your DB server has a limit on connections and the initialize method fails because of that because you're exceeding it
<ktulu> all im getting is that it wont fire
<ktulu> ie a puts in add msg will not fuire
<dominikh> will a puts after line 17? :)
<ktulu> yes
<ktulu> well
<ktulu> hold on
<ktulu> thought I did that
<dominikh> and again, check the logs for a) exceptions b) (the lack of) messages indicating matches and handlers that get spawned
<ktulu> now they're bothing doing it...dammit
<ktulu> now it does it in the dev environment
<ktulu> and 10 bucks says closing it doesnt clean up my cons and mysql is flipping out
<ktulu> nope only 33
<ktulu> and yeah line 17 fires
<ktulu> er a puts after it does
<dominikh> the exception gives it away
<dominikh> but really, this is something you'll have to debug yourself. I only work with MySQL when I get paid to do so ;)
<ktulu> fair enough .
<ktulu> appreciate wehat ya did give me.
<dominikh> (also I don't know that library, at all)
<ktulu> smae. its supposed to be asynchronus but eh. I get what the exception is saying. but damn.
<ktulu> later man
ktulu has quit [Quit: leaving]
Dunke has quit [Remote host closed the connection]
_whitelogger has joined #cinch
<liru> dominikh: Any status on that Golang IRC library? :3
<dominikh> there's no status to be had here. I wrote a PoC once, and that's all there'll ever be :)
<dominikh> liru: ^
<liru> Aw. Was hoping the answer would be "Oh, right, fully ported Cinch over to go, just forgot to push everything to the repo"
<liru> :P
<dominikh> haha. no, that won't happen; I don't particularly enjoy working on IRC libs anymore ;)
<liru> Yeah, understandable. I know that feeling
<liru> Still, it was worth a shot to ask
<dominikh> sorry to disappoint ;)
frog|OFF is now known as green-big-frog
green-big-frog is now known as frog|OFF
xbob has joined #cinch
blindsight has quit [Ping timeout: 245 seconds]
djbkd has quit [Quit: My people need me...]
Netfeed has joined #cinch
chadrien has quit [Quit: leaving]
postmodern has quit [Quit: Leaving]
sarkyniin has joined #cinch
Dunke has joined #cinch
sarkyniin has quit [Ping timeout: 255 seconds]
sarkyniin has joined #cinch
xbob has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Dunke_ has joined #cinch
Dunke_ has quit [Read error: Connection reset by peer]
frog|OFF is now known as green-big-frog
xbob has joined #cinch
sarkyniin has quit [Read error: Connection reset by peer]
sarkyniin has joined #cinch
green-big-frog is now known as frog|OFF
xbob_ has joined #cinch
sarkyniin has quit [Ping timeout: 255 seconds]
xbob has quit [Ping timeout: 272 seconds]
xbob has joined #cinch
xbob_ has quit [Ping timeout: 246 seconds]
TieSoul is now known as TieSleep
kith has quit [Quit: kith]
kith has joined #cinch
postmodern has joined #cinch
tyil has joined #cinch
<tyil> hi
<tyil> can anyone tell me if its possible to make a cinch bot talk at random intervals (say, between 10 and 30 minutes)?
<dominikh> look at the timer example
djbkd has joined #cinch
xbob has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Dunke has quit [Remote host closed the connection]