mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
fix nil raft server caused crash
fix https://github.com/chrislusf/seaweedfs/issues/524
This commit is contained in:
parent
1fbb8723dc
commit
f9a1769df1
|
@ -3,26 +3,25 @@ package weed_server
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/chrislusf/raft"
|
||||||
|
ui "github.com/chrislusf/seaweedfs/weed/server/master_ui"
|
||||||
"github.com/chrislusf/seaweedfs/weed/stats"
|
"github.com/chrislusf/seaweedfs/weed/stats"
|
||||||
"github.com/chrislusf/seaweedfs/weed/util"
|
"github.com/chrislusf/seaweedfs/weed/util"
|
||||||
ui "github.com/chrislusf/seaweedfs/weed/server/master_ui"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func (ms *MasterServer) uiStatusHandler(w http.ResponseWriter, r *http.Request) {
|
func (ms *MasterServer) uiStatusHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
infos := make(map[string]interface{})
|
infos := make(map[string]interface{})
|
||||||
infos["Version"] = util.VERSION
|
infos["Version"] = util.VERSION
|
||||||
args := struct {
|
args := struct {
|
||||||
Version string
|
Version string
|
||||||
Topology interface{}
|
Topology interface{}
|
||||||
Leader string
|
RaftServer raft.Server
|
||||||
Peers interface{}
|
Stats map[string]interface{}
|
||||||
Stats map[string]interface{}
|
Counters *stats.ServerStats
|
||||||
Counters *stats.ServerStats
|
|
||||||
}{
|
}{
|
||||||
util.VERSION,
|
util.VERSION,
|
||||||
ms.Topo.ToMap(),
|
ms.Topo.ToMap(),
|
||||||
ms.Topo.RaftServer.Leader(),
|
ms.Topo.RaftServer,
|
||||||
ms.Topo.RaftServer.Peers(),
|
|
||||||
infos,
|
infos,
|
||||||
serverStats,
|
serverStats,
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@ var StatusTpl = template.Must(template.New("status").Parse(`<!DOCTYPE html>
|
||||||
<th>Max</th>
|
<th>Max</th>
|
||||||
<td>{{ .Topology.Max }}</td>
|
<td>{{ .Topology.Max }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
{{ with .RaftServer }}
|
||||||
<tr>
|
<tr>
|
||||||
<th>Leader</th>
|
<th>Leader</th>
|
||||||
<td><a href="http://{{ .Leader }}">{{ .Leader }}</a></td>
|
<td><a href="http://{{ .Leader }}">{{ .Leader }}</a></td>
|
||||||
|
@ -45,6 +46,7 @@ var StatusTpl = template.Must(template.New("status").Parse(`<!DOCTYPE html>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</ul></td>
|
</ul></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
{{ end }}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue