Git Product home page Git Product logo

Comments (9)

leafo avatar leafo commented on September 7, 2024

You can pass the same parameters you pass to the ngx keepalive method to the pg object's keepalive method

https://github.com/leafo/pgmoon#success-err--postgreskeepalive

from pgmoon.

gzliudan avatar gzliudan commented on September 7, 2024

But I didn't find parameters in the source code of pgmoon/init.moon and pgmoon/socket.lua.
By the way, would you please upload pgmoon to http://opm.openresty.org/ ? So I can use opm command to update pgmoon.

from pgmoon.

leafo avatar leafo commented on September 7, 2024

@gzliudan the ... is used to pas parameters through to openresty, so their names aren't explicitly listed in this project's source code

I updated the package on opm

from pgmoon.

gzliudan avatar gzliudan commented on September 7, 2024

thanks a lot. I updated pgmoon through opm command.

Can you give an example how to set parameters of connection pool?

from pgmoon.

leafo avatar leafo commented on September 7, 2024
-- when you want to return the connection to the pool:
pg:keepalive(timeout, pool_size)

-- if you need to configure the pool name:
pgmoon.new({
  pool = "custom pool name",  
  -- ...
})

Generally you don't need to configure the pool name since it will choose a reasonable default based on connection settings.

from pgmoon.

gzliudan avatar gzliudan commented on September 7, 2024

Thank you very much.
Does the unit of timeout is second? What happenes if pool_size is different value when call pg:keepalive with last time.

from pgmoon.

leafo avatar leafo commented on September 7, 2024

Check out the docs https://github.com/openresty/lua-nginx-module#tcpsocksetkeepalive

from pgmoon.

gzliudan avatar gzliudan commented on September 7, 2024

Thank you again. Maybe it's better update ReadMe.

from pgmoon.

devvit avatar devvit commented on September 7, 2024

52 closed, continue here.

There are similar issues: 47, 64

How to limit connections in openresty? The answer is here

Basically, we cannot strictly limit connections, in practice, lua_socket_pool_size or #tcpsocksetkeepalive is both overflow-able, that's why cosocket has huge concurrency.

openresty group has more details, for example this

from pgmoon.

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.