mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-10-09 15:57:47 +02:00
chore(weed/command): prune unused functions (#9573)
* chore(weed/command): prune unused functions * drop now-unused closed field and renderLocked guard --------- Co-authored-by: Chris Lu <chris.lu@gmail.com>
This commit is contained in:
1 parent
cc5ef1b741
commit
9914e6af30
1 file changed
-28
@@ -90,7 +90,6 @@ type miniProgress struct {
|
||||
elapsed map[string]time.Duration
|
||||
isTTY bool
|
||||
rendered bool
|
||||
closed bool
|
||||
}
|
||||
|
||||
const miniProgressNameWidth = 12
|
||||
@@ -141,7 +140,6 @@ func (p *miniProgress) update(name, state string) {
|
||||
func (p *miniProgress) starting(name string) { p.update(name, "starting") }
|
||||
func (p *miniProgress) ready(name string) { p.update(name, "ready") }
|
||||
func (p *miniProgress) failed(name string) { p.update(name, "failed") }
|
||||
func (p *miniProgress) stopping(name string) { p.update(name, "stopping") }
|
||||
func (p *miniProgress) stopped(name string) { p.update(name, "stopped") }
|
||||
|
||||
// renderLocked redraws every row in the board. Caller must hold p.mu and
|
||||
@@ -149,9 +147,6 @@ func (p *miniProgress) stopped(name string) { p.update(name, "stopped") }
|
||||
// ESC[2K clears the line — leaving the cursor parked one line below the last
|
||||
// row so the next print (welcome banner, shutdown messages) flows naturally.
|
||||
func (p *miniProgress) renderLocked() {
|
||||
if p.closed {
|
||||
return
|
||||
}
|
||||
if p.rendered {
|
||||
fmt.Printf("\033[%dA", len(p.order))
|
||||
}
|
||||
@@ -194,14 +189,6 @@ func (p *miniProgress) reset(services []string, initialState string) {
|
||||
}
|
||||
}
|
||||
|
||||
// close prevents further redraws (e.g. before a Fatalf so the panic doesn't
|
||||
// repaint the board). Safe to call multiple times.
|
||||
func (p *miniProgress) close() {
|
||||
p.mu.Lock()
|
||||
defer p.mu.Unlock()
|
||||
p.closed = true
|
||||
}
|
||||
|
||||
// reportMiniStopped marks a service as fully stopped on the progress board.
|
||||
// Safe to call when the board is nil (mini not running) — used from defers
|
||||
// in service goroutines so a normal exit (Ctrl+C, ctx cancel) flips the row.
|
||||
@@ -266,21 +253,6 @@ func resetMiniClients() {
|
||||
miniClients = s
|
||||
}
|
||||
|
||||
// onMiniClientsShutdown runs fn when mini shutdown is triggered, and tracks
|
||||
// it so the interrupt hook can wait for it to drain. No-op outside mini.
|
||||
func onMiniClientsShutdown(fn func()) {
|
||||
s := miniClients
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
s.wg.Add(1)
|
||||
go func() {
|
||||
defer s.wg.Done()
|
||||
<-s.ctx.Done()
|
||||
fn()
|
||||
}()
|
||||
}
|
||||
|
||||
// trackMiniClient registers an externally-managed goroutine (one that
|
||||
// observes miniClientsCtx() itself) so the interrupt hook waits for it.
|
||||
// The caller invokes the returned done func when the goroutine exits.
|
||||
|
||||
Reference in new issue
Block a user