| 235 | } |
| 236 | |
| 237 | func (s *Server) zeroHealth(ctx context.Context) (*api.Response, error) { |
| 238 | if ctx.Err() != nil { |
| 239 | return nil, errors.Wrap(ctx.Err(), "http request context error") |
| 240 | } |
| 241 | health := &pb.HealthInfo{ |
| 242 | Instance: "zero", |
| 243 | Address: x.WorkerConfig.MyAddr, |
| 244 | Status: "healthy", |
| 245 | Version: x.Version(), |
| 246 | Uptime: int64(time.Since(x.WorkerConfig.StartTime) / time.Second), |
| 247 | LastEcho: time.Now().Unix(), |
| 248 | } |
| 249 | jsonOut, err := json.Marshal(health) |
| 250 | if err != nil { |
| 251 | return nil, errors.Wrapf(err, "unable to marshal zero health, error") |
| 252 | } |
| 253 | return &api.Response{Json: jsonOut}, nil |
| 254 | } |
| 255 | |
| 256 | func (st *state) pingResponse(w http.ResponseWriter, r *http.Request) { |
| 257 | x.AddCorsHeaders(w) |