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
zGo
Commits
7fd7ad91
Commit
7fd7ad91
authored
Aug 09, 2025
by
Vladimir Barsukov
Browse files
fix
parent
2235285a
Changes
2
Hide whitespace changes
Inline
Side-by-side
zdb/pool.go
View file @
7fd7ad91
...
...
@@ -20,7 +20,6 @@ type Pool struct {
slavesIter
*
atomic
.
Int64
slavesAsyncIter
*
atomic
.
Int64
stop
bool
Continues
[]
string
ContinuesTry
[]
string
TryOnError
int
...
...
@@ -45,7 +44,6 @@ func (d *Pool) WithContext(ctx context.Context) *Pool {
notAliveConns
:
d
.
notAliveConns
,
slavesIter
:
d
.
slavesIter
,
slavesAsyncIter
:
d
.
slavesAsyncIter
,
stop
:
d
.
stop
,
Continues
:
d
.
Continues
,
ContinuesTry
:
d
.
ContinuesTry
,
TryOnError
:
d
.
TryOnError
,
...
...
@@ -282,14 +280,9 @@ func (d *Pool) setNotAliveConn(conn *Conn) {
}
}
func
(
d
*
Pool
)
Start
()
{
d
.
stop
=
false
func
(
d
*
Pool
)
startPing
()
{
go
func
()
{
for
{
if
d
.
stop
{
return
}
rep
:
for
i
,
q
:=
range
d
.
notAliveConns
{
...
...
@@ -317,10 +310,6 @@ func (d *Pool) Start() {
}()
}
func
(
d
*
Pool
)
Stop
()
{
d
.
stop
=
true
}
func
(
d
*
Pool
)
IsAlive
()
bool
{
return
d
.
SrvMaster
!=
nil
&&
d
.
SrvMaster
.
Alive
}
...
...
zdb/zdb.go
View file @
7fd7ad91
...
...
@@ -9,7 +9,7 @@ import (
)
func
New
(
ctx
context
.
Context
)
*
Pool
{
return
&
Pool
{
p
:=
&
Pool
{
ctx
:
ctx
,
mu
:
&
sync
.
RWMutex
{},
slavesIter
:
&
atomic
.
Int64
{},
...
...
@@ -21,6 +21,9 @@ func New(ctx context.Context) *Pool {
PingTimeout
:
time
.
Second
*
5
,
PingTry
:
5
,
}
p
.
startPing
()
return
p
}
func
NewDefault
()
*
Pool
{
...
...
@@ -33,7 +36,6 @@ func NewDefault() *Pool {
func
NewMaster
(
conn
string
)
*
Pool
{
s
:=
NewDefault
()
_
=
s
.
NewConn
(
ConnModeMaster
,
conn
)
s
.
Start
()
return
s
}
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