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