mirror of
https://github.com/minio/minio.git
synced 2025-02-03 09:55:59 -05:00
Adding comments to explain design decisions in server.go
This commit is contained in:
parent
f15e2c4e74
commit
66cc370e8b
@ -109,8 +109,10 @@ func Start(config ServerConfig) {
|
|||||||
ctrlChans = append(ctrlChans, ctrlChan)
|
ctrlChans = append(ctrlChans, ctrlChan)
|
||||||
statusChans = append(statusChans, statusChan)
|
statusChans = append(statusChans, statusChan)
|
||||||
|
|
||||||
|
// listen for critical errors
|
||||||
|
// TODO Handle critical errors appropriately when they arise
|
||||||
|
// reflected looping is necessary to remove dead channels from loop and not flood switch
|
||||||
cases := createSelectCases(statusChans)
|
cases := createSelectCases(statusChans)
|
||||||
|
|
||||||
for len(cases) > 0 {
|
for len(cases) > 0 {
|
||||||
chosen, value, recvOk := reflect.Select(cases)
|
chosen, value, recvOk := reflect.Select(cases)
|
||||||
if recvOk == true {
|
if recvOk == true {
|
||||||
@ -131,6 +133,9 @@ func Start(config ServerConfig) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// creates select cases for reflect to switch over dynamically
|
||||||
|
// this is necessary in order to remove dead channels and not flood
|
||||||
|
// the loop with closed channel errors
|
||||||
func createSelectCases(channels []<-chan error) []reflect.SelectCase {
|
func createSelectCases(channels []<-chan error) []reflect.SelectCase {
|
||||||
cases := make([]reflect.SelectCase, len(channels))
|
cases := make([]reflect.SelectCase, len(channels))
|
||||||
for i, ch := range channels {
|
for i, ch := range channels {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user