aboutsummaryrefslogtreecommitdiff
path: root/weed/shell/command_volume_server_evacuate.go
diff options
context:
space:
mode:
authorKonstantin Lebedev <9497591+kmlebedev@users.noreply.github.com>2022-07-20 00:54:23 +0500
committerKonstantin Lebedev <9497591+kmlebedev@users.noreply.github.com>2022-07-20 00:54:23 +0500
commitd3f7c09c03168fc0c29dd19c90dd9d2c86b2bda3 (patch)
treed3948130d85971d6825b722a257772ee3b301a83 /weed/shell/command_volume_server_evacuate.go
parentd422e7769c7f52cd250c3bf8ced279cfef8c8ef0 (diff)
downloadseaweedfs-d3f7c09c03168fc0c29dd19c90dd9d2c86b2bda3.tar.xz
seaweedfs-d3f7c09c03168fc0c29dd19c90dd9d2c86b2bda3.zip
remove ticker
update the topology before each file
Diffstat (limited to 'weed/shell/command_volume_server_evacuate.go')
-rw-r--r--weed/shell/command_volume_server_evacuate.go26
1 files changed, 9 insertions, 17 deletions
diff --git a/weed/shell/command_volume_server_evacuate.go b/weed/shell/command_volume_server_evacuate.go
index c9df2c79a..f72d73230 100644
--- a/weed/shell/command_volume_server_evacuate.go
+++ b/weed/shell/command_volume_server_evacuate.go
@@ -11,11 +11,8 @@ import (
"golang.org/x/exp/slices"
"io"
"os"
- "time"
)
-const topologyInfoUpdateInterval = 5 * time.Minute
-
func init() {
Commands = append(Commands, &commandVolumeServerEvacuate{})
}
@@ -117,23 +114,18 @@ func (c *commandVolumeServerEvacuate) evacuateNormalVolumes(commandEnv *CommandE
}
// move away normal volumes
- ticker := time.NewTicker(topologyInfoUpdateInterval)
- defer ticker.Stop()
for _, thisNode := range thisNodes {
for _, diskInfo := range thisNode.info.DiskInfos {
if applyChange {
- select {
- case <-ticker.C:
- if topologyInfo, _, err := collectTopologyInfo(commandEnv, 0); err != nil {
- fmt.Fprintf(writer, "update topologyInfo %v", err)
- } else {
- _, otherNodesNew := c.nodesOtherThan(
- collectVolumeServersByDc(topologyInfo, ""), volumeServer)
- if len(otherNodesNew) > 0 {
- otherNodes = otherNodesNew
- c.topologyInfo = topologyInfo
- fmt.Fprintf(writer, "topologyInfo updated %v\n", len(otherNodes))
- }
+ if topologyInfo, _, err := collectTopologyInfo(commandEnv, 0); err != nil {
+ fmt.Fprintf(writer, "update topologyInfo %v", err)
+ } else {
+ _, otherNodesNew := c.nodesOtherThan(
+ collectVolumeServersByDc(topologyInfo, ""), volumeServer)
+ if len(otherNodesNew) > 0 {
+ otherNodes = otherNodesNew
+ c.topologyInfo = topologyInfo
+ fmt.Fprintf(writer, "topologyInfo updated %v\n", len(otherNodes))
}
}
}