GithubHelp home page GithubHelp logo

Comments (3)

vitaly-t avatar vitaly-t commented on May 24, 2024

Cancelling queries isn't a frequent feature to be used by developers, for sure. In fact, you are the first one to ever ask about it.

I personally have never used it. And now that you have asked, I just had a quick look at its implementation in file index.js

// cancel the query runned by the given client
PG.prototype.cancel = function(config, client, query) {
  if(client.native) {
    return client.cancel(query);
  }
  var c = config;
  //allow for no config to be passed
  if(typeof c === 'function') {
    c = defaults;
  }
  var cancellingClient = new this.Client(c);
  cancellingClient.cancel(client, query);
};

I'm not sure how this function really works underneath - is it synchronous or asynchronous? If it is the latter, then what even does it provide? It would be interesting to find out.

In the meantime, you can access the pg instance via pgp.pg property, and call pgp.pg.cancel() the way you used to, I just don't know yet how it will work in this case. I think it was initially designed for use with the native client only, and since this library relies on connections from the pool,...

Try and see if it works, and let us know ;)

from pg-promise.

vitaly-t avatar vitaly-t commented on May 24, 2024

@DomenicoColandrea86 any update there? ;)

from pg-promise.

vitaly-t avatar vitaly-t commented on May 24, 2024

Closing due to inactivity.

from pg-promise.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.