Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Vladimir Barsukov
zGo
Commits
f1b4a007
Commit
f1b4a007
authored
1 year ago
by
Vladimir Barsukov
Browse files
Options
Download
Email Patches
Plain Diff
pool_max_conns
parent
6d4bbe0a
master
v1.6.4
v1.6.3
v1.6.2
v1.6.1
v1.6.0
v1.5.4
v1.5.3
v1.5.2
v1.5.1
v1.5.0
v1.4.8
v1.4.7
v1.4.6
v1.4.5
v1.4.4
v1.4.3
v1.4.2
v1.4.1
v1.4.0
v1.3.1
v1.3.0
v1.2.1
v1.2.0
v1.1.1
v1.1.0
v1.0.9
v1.0.8
v1.0.7
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
zatomic/uint64.go
+31
-0
zatomic/uint64.go
zdb/pool.go
+5
-0
zdb/pool.go
with
36 additions
and
0 deletions
+36
-0
zatomic/uint64.go
0 → 100644
+
31
-
0
View file @
f1b4a007
package
zatomic
import
"sync/atomic"
type
UInt64
struct
{
v
*
atomic
.
Uint64
}
func
NewUInt64
()
*
UInt64
{
return
&
UInt64
{
v
:
&
atomic
.
Uint64
{}}
}
func
(
i
*
UInt64
)
Store
(
v
int
)
{
i
.
v
.
Store
(
uint64
(
v
))
}
func
(
i
*
UInt64
)
Add
(
delta
int
)
uint64
{
return
i
.
v
.
Add
(
uint64
(
delta
))
}
func
(
i
*
UInt64
)
Inc
()
uint64
{
return
i
.
Add
(
1
)
}
func
(
i
*
UInt64
)
Dec
()
uint64
{
return
i
.
Add
(
-
1
)
}
func
(
i
*
UInt64
)
Load
()
uint64
{
return
i
.
v
.
Load
()
}
This diff is collapsed.
Click to expand it.
zdb/pool.go
+
5
-
0
View file @
f1b4a007
...
...
@@ -6,6 +6,7 @@ import (
"github.com/jackc/pgx/v5/pgxpool"
"log"
"reflect"
"runtime"
"strconv"
"strings"
"sync"
...
...
@@ -154,6 +155,10 @@ func (d *Pool) newConn(mode connMode, pgConnString string) (q *Conn, err error)
pgConnString
+=
" sslmode=disable"
}
if
!
strings
.
Contains
(
pgConnString
,
"pool_max_conns="
)
{
pgConnString
+=
fmt
.
Sprintf
(
" pool_max_conns=%d"
,
runtime
.
NumCPU
()
*
2
)
}
if
pgxConfig
,
err
=
pgxpool
.
ParseConfig
(
pgConnString
);
err
!=
nil
{
return
nil
,
err
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Snippets