Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Vladimir Barsukov
zdb
Commits
63993088
Commit
63993088
authored
May 20, 2023
by
Vladimir Barsukov
Browse files
save
parent
5afc3dc5
Pipeline
#41
canceled with stages
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
pool.go
View file @
63993088
...
...
@@ -27,6 +27,8 @@ type Pool struct {
slavesIter
*
atomic
.
Int64
slavesAsyncIter
*
atomic
.
Int64
stop
bool
}
func
New
()
*
Pool
{
...
...
@@ -188,9 +190,15 @@ func (d *Pool) setNotAliveConn(conn *conn) {
}
}
func
(
d
*
Pool
)
Test
()
{
func
(
d
*
Pool
)
Start
()
{
d
.
stop
=
false
go
func
()
{
for
{
if
d
.
stop
{
return
}
for
i
,
q
:=
range
d
.
notAliveConns
{
if
err
:=
d
.
ping
(
q
);
err
==
nil
{
d
.
mu
.
Lock
()
...
...
@@ -212,6 +220,10 @@ func (d *Pool) Test() {
}()
}
func
(
d
*
Pool
)
Stop
()
{
d
.
stop
=
true
}
func
(
d
*
Pool
)
prepare
(
sql
string
,
param
map
[
string
]
any
)
string
{
for
n
,
t
:=
range
param
{
switch
t
.
(
type
)
{
...
...
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