Skip to content

Commit 25dd85c

Browse files
author
Gleez Technologies
committed
Remove some dead code in stats
1 parent 1a5e258 commit 25dd85c

File tree

1 file changed

+2
-82
lines changed

1 file changed

+2
-82
lines changed

river/status.go

Lines changed: 2 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,8 @@ type stat struct {
4949
DeleteAffectedRows sync2.AtomicUint64
5050
DeleteQueries sync2.AtomicUint64
5151
DeleteQueryDocs sync2.AtomicUint64
52-
53-
// RebuildLog []buildLogRecord
5452
}
5553

56-
// type buildLogRecord struct {
57-
// ID string
58-
// IndexList []string
59-
// StartedAt time.Time
60-
// FinishedAt *time.Time
61-
// Success bool
62-
// }
63-
6454
type statusInfo struct {
6555
Uptime string
6656
UptimeNano int64
@@ -85,10 +75,8 @@ type statusInfo struct {
8575
DeleteAffectedRows uint64
8676
DeleteQueries uint64
8777
DeleteQueryDocs uint64
88-
// RebuildInProgress []string
89-
// RebuildLog []buildLogRecord
90-
Running bool
91-
Syncing bool
78+
Running bool
79+
Syncing bool
9280
}
9381

9482
var getStatusInfo func() interface{}
@@ -157,31 +145,6 @@ func (s *stat) getStatusInfo() interface{} {
157145
return status
158146
}
159147

160-
// func (s *stat) logRebuildStart(b indexGroupBuild) {
161-
// s.m.Lock()
162-
// defer s.m.Unlock()
163-
// r := buildLogRecord{
164-
// ID: b.id,
165-
// IndexList: b.indexSlice(),
166-
// StartedAt: time.Now(),
167-
// }
168-
// s.RebuildLog = append(s.RebuildLog, r)
169-
// }
170-
171-
// func (s *stat) logRebuildFinish(buildID string, err error) {
172-
// s.m.Lock()
173-
// defer s.m.Unlock()
174-
// for i, r := range s.RebuildLog {
175-
// if r.ID == buildID {
176-
// now := time.Now()
177-
// r.FinishedAt = &now
178-
// r.Success = err == nil
179-
// s.RebuildLog[i] = r
180-
// break
181-
// }
182-
// }
183-
// }
184-
185148
func (s *stat) ServeHTTP(w http.ResponseWriter, r *http.Request) {
186149
var buf bytes.Buffer
187150
encoder := json.NewEncoder(&buf)
@@ -306,49 +269,6 @@ func handleReadyz(s *stat) http.HandlerFunc {
306269
})
307270
}
308271

309-
// func handleRebuildRedir() http.HandlerFunc {
310-
// return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
311-
// w.Header().Add("Link", "</rebuild/sync>; rel=\"alternate\"")
312-
// w.Header().Add("Link", "</rebuild/async>; rel=\"alternate\"")
313-
// w.WriteHeader(http.StatusMultipleChoices)
314-
// w.Write([]byte(`
315-
// <html>
316-
// <body>
317-
// <p>You can rebuild all configured indexes by making a POST request to one of these endpoints:</p>
318-
// <ul>
319-
// <li><a href="/rebuild/sync">/rebuild/sync</a> - synchronously</li>
320-
// <li><a href="/rebuild/async">/rebuild/async</a> - asynchronously</li>
321-
// </ul>
322-
// </body>
323-
// </html>
324-
// `))
325-
// })
326-
// }
327-
328-
// func handleRebuild(r *River, sync bool) http.HandlerFunc {
329-
// return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
330-
// w.Header().Set("Content-Type", "text/plain; charset=utf-8")
331-
// if req.Method != http.MethodPost {
332-
// w.WriteHeader(http.StatusMethodNotAllowed)
333-
// w.Write([]byte("unexpected method\n"))
334-
// return
335-
// }
336-
// reason := "requested via http endpoint"
337-
// if sync {
338-
// err := r.rebuildAll(req.Context(), reason)
339-
// if err != nil {
340-
// w.WriteHeader(http.StatusInternalServerError)
341-
// w.Write([]byte(errors.ErrorStack(err)))
342-
// } else {
343-
// w.WriteHeader(http.StatusNoContent)
344-
// }
345-
// } else {
346-
// go r.rebuildAll(nil, reason)
347-
// w.WriteHeader(http.StatusAccepted)
348-
// }
349-
// })
350-
// }
351-
352272
func handleStartSync(r *River, sync bool) http.HandlerFunc {
353273
return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
354274
w.Header().Set("Content-Type", "text/plain; charset=utf-8")

0 commit comments

Comments
 (0)