Hi, Does:
Sequel.connect(API.configuration.database) Return a single connection, or a connection factory? I've been seeing issues with postgresql that seem to indicate it is a single connection on which a single command can be run at a time, but it has been suggested it will "pool" the connections and new commands to the database will get new connections automatically. The error I get is: Sequel::DatabaseError: PG::UnableToSend: another command is already in progress I suspect this is caused by streaming results while creating new commands based on those results, e.g. query.each do |row| do and update based on the row end As I understand it, a db connections (generally) only supports one active command; so while the query is streaming the results the "reader" command is active. When the update command is attempted the "another command is already in progress" would happen. To avoid this I've seen a pattern in other languages that acquire a new connection from the pool for each command to be issued and return it back to the pool after the command finishes. From reading through the sequel postgres code I can't see anywhere this would be happening automatically, and it appears to acquire the connection from the pg driver just once. That would make me think the caller would be responsible for wrapping each command in a new connection to avoid this issue of stacking up commands on a single connection. Do I have that right, or am I missing something? Thanks, Cliff. -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/sequel-talk. For more options, visit https://groups.google.com/d/optout.
