neumino / thinky

JavaScript ORM for RethinkDB
http://justonepixel.com/thinky/
Other
1.12k stars 128 forks source link

Thinky without dash? #550

Open davidroman0O opened 8 years ago

davidroman0O commented 8 years ago

Hi!

I use Thinky on different projects with express. I've been moving to AWS Lambda few months ago, using only rethinkdb official driver for a unique reason i haven't reported yet!

I'm not sure i'm reporting a bug, nor even a feature. It's up to you to decide what it is. 😄

On AWS Lambda, when you use Thinky (that are inside of another library in a node_module) on a function who need an EC2 with RethinkDB, you will have some issues with the pooling system of Rethinkdbdash who are unenable to close connections.

It works for the first connections but after a while, everything is locked with timeout from the EC2 instance who refused connections from the function.

This issue lock the EC2 instance with non-closed connection during a long time. I've done a looooot of tests (&& debuging) to be sure of what i'm writing right now.

It's exactly this line who failed on the AWS Lambda environment:

https://github.com/neumino/rethinkdbdash/blob/master/lib/pool_master.js#L449

Sooooo, it will possible to have one day a fork of Thinky with the officiel driver of RethinkDB? (and without pool connections of course)

I'm asking this question because it's a REAL pleasure to work with Thinky on a standalone NodeJS + Express. It's simplify my workflow a lot and i would like to work again with my teammates. 😄

I hope you will take some attention to this issue @neumino, 'cause i love too much Thinky && RethinkDB.

timaschew commented 8 years ago

@warka0 please do never link to lines of a branch, especially of the master branch. Before coping the URL press y this will generate a permanent URL, in this case: https://github.com/neumino/rethinkdbdash/blob/d6f55dddfc0ba941879050a3b606c7ce63513c17/lib/pool_master.js#L449

davidroman0O commented 8 years ago

@timaschew Ok, no problem. Sorry for that. :)

neumino commented 8 years ago

Hum, it's not possible at the moment. Rethinkdbdash lets you open your own connection/close it if you want by passing pool: false, but thinky doesn't let you do that.

To get the official driver or rethinkdbdash without a pool to work with thinky, we need to update all the part where a query and take a connection as argument.

davidroman0O commented 8 years ago

I'll try with manual closing for rethinkdash but I won't take the risk to keep it in production.

Actually, i mimic the old way with schema-inspector library and an home made sandbox with connection argument. I need to validate the object model each time before insert/update.

Take your time, it could be a wonderful feature for thoses who do serverless apps :)