mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
storage/backend: remove startc var
This makes start logic cleaner.
This commit is contained in:
parent
f04884f74d
commit
054fab84ee
@ -23,7 +23,6 @@ type backend struct {
|
||||
batchTx *batchTx
|
||||
|
||||
stopc chan struct{}
|
||||
startc chan struct{}
|
||||
donec chan struct{}
|
||||
}
|
||||
|
||||
@ -41,12 +40,11 @@ func New(path string, d time.Duration, limit int) Backend {
|
||||
batchTx: &batchTx{},
|
||||
|
||||
stopc: make(chan struct{}),
|
||||
startc: make(chan struct{}),
|
||||
donec: make(chan struct{}),
|
||||
}
|
||||
b.batchTx.backend = b
|
||||
b.batchTx.Commit()
|
||||
go b.run()
|
||||
<-b.startc
|
||||
return b
|
||||
}
|
||||
|
||||
@ -73,9 +71,6 @@ func (b *backend) Snapshot(w io.Writer) (n int64, err error) {
|
||||
func (b *backend) run() {
|
||||
defer close(b.donec)
|
||||
|
||||
b.batchTx.Commit()
|
||||
b.startc <- struct{}{}
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-time.After(b.batchInterval):
|
||||
|
Loading…
x
Reference in New Issue
Block a user