sh를 통으로 atomic하게 교체
This commit is contained in:
@ -257,8 +257,7 @@ func (caller apiCaller) serviceAPI(w http.ResponseWriter, r *http.Request) error
|
||||
atomic.StorePointer(&mg.serviceptr, unsafe.Pointer(&newService))
|
||||
}
|
||||
|
||||
serptr := atomic.LoadPointer(&mg.service().serviceSerialized)
|
||||
w.Write(*(*[]byte)(serptr))
|
||||
w.Write(mg.service().divisionsSerialized)
|
||||
} else if r.Method == "POST" {
|
||||
body, _ := io.ReadAll(r.Body)
|
||||
var service serviceDescription
|
||||
@ -293,8 +292,7 @@ func (caller apiCaller) serviceAPI(w http.ResponseWriter, r *http.Request) error
|
||||
func (caller apiCaller) maintenanceAPI(w http.ResponseWriter, r *http.Request) error {
|
||||
mg := caller.mg
|
||||
if r.Method == "GET" {
|
||||
serptr := atomic.LoadPointer(&mg.service().divisionsSerialized)
|
||||
w.Write(*(*[]byte)(serptr))
|
||||
w.Write(mg.service().divisionsSerialized)
|
||||
} else if r.Method == "POST" {
|
||||
var divs map[string]*Division
|
||||
dec := json.NewDecoder(r.Body)
|
||||
|
||||
Reference in New Issue
Block a user