Skip to content

Fix #109 bug transaction concurrency. #146

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

robinbiondi
Copy link

When running more than 9 transactions at the same time, we get an error: "pool.release is not a function". at line 74 in lib/transaction.js.
I found out that this.pg is returning an EvenEmitter, containing a pool which contains the function release.
Finally, when I call pool.pool.release instead of pool.release, everything works fine and the connections are released on my pg database.
This modification fixes the issue #109.

@slnode
Copy link

slnode commented Jun 24, 2016

Can one of the admins verify this patch? To accept patch and trigger a build add comment ".ok\W+to\W+test."

@slnode
Copy link

slnode commented Jun 24, 2016

Can one of the admins verify this patch?

@Elindorath
Copy link

When can this PR could be merged? I think it is a very small and highly valuable one! 😉

@robinbiondi
Copy link
Author

Hello @raymondfeng. Do you have an idea of when this PR could be processed?
Cheers,

@slnode
Copy link

slnode commented Jul 21, 2016

Can one of the admins verify this patch?

@superkhau
Copy link
Contributor

Can you add some tests to verify your changes and prevent regressions in the future?

In addition, can you rebase with master to get the latest changes on this PR?

@superkhau superkhau self-assigned this Jul 21, 2016
@cadesalaberry
Copy link

Hi there,

What kind of test do you expect for this PR to be merged ?

TLDR: this.pg.release() does not exist. this.pg.pool.release() does.

From what I saw, if you follow the callstack, that's where we start:

function PostgreSQL(postgresql, settings) {
   ...
  this.pg = new postgresql.Pool(this.clientConfig);
  this.settings = settings;
  ...
}

Down the trail, you see that Pool comes from a poolFactory which returns a pg-pool module:

PG = function(clientConstructor) {
  EventEmitter.call(this);
  ...
  this.Client = clientConstructor;
  this.Pool = poolFactory(this.Client);
  ...
};

That's where the naming is confusing, as the pg-pool module also contains a pool object:

Pool = module.exports = function (options, Client) {
  ...
  this.options = objectAssign({}, options)
  ...
  this.pool = new genericPool.Pool(this.options)
  ...
}

here if you want to release the pool, you will have to go through the pool object in which there in an actual pool to release.

@slnode
Copy link

slnode commented Sep 27, 2016

Can one of the admins verify this patch?

@superkhau superkhau assigned 0candy and unassigned superkhau Oct 13, 2016
zbarbuto added a commit to NextFaze/loopback-connector-postgresql that referenced this pull request Nov 10, 2016
This was referenced Jan 10, 2017
@slnode
Copy link

slnode commented Jan 18, 2017

Can one of the admins verify this patch?

@ssh24
Copy link
Contributor

ssh24 commented Apr 24, 2017

@robinbiondi Could you please sign the CLA so we can proceed with this PR?https://cla.strongloop.com/agreements/strongloop/loopback-connector-postgresql

@slnode test please

Ignore my comment. This fix has been applied in #197. Closing this PR as a result.

@robinbiondi
Copy link
Author

@ssh24 I just did it.

Thanks!

@ssh24 ssh24 added the apex label Apr 24, 2017
@ssh24 ssh24 closed this Apr 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants