Restore debug handler

This commit is contained in:
2014-09-24 14:13:08 +04:00
parent 2a6f063ab0
commit 8365c05961
4 changed files with 41 additions and 32 deletions
+23 -1
View File
@@ -78,7 +78,7 @@ func (s *Storage) Put(queue string, message []byte) (err error) {
return
}
func (s *Storage) Info() map[string]uint {
func (s *Storage) QueueSizes() map[string]uint {
info := make(map[string]uint)
for queue, c := range s.counters {
@@ -88,6 +88,28 @@ func (s *Storage) Info() map[string]uint {
return info
}
func (s *Storage) Info() map[string]interface{} {
info := make(map[string]interface{})
status, err := s.kyoto.Status()
if err != nil {
panic(err)
}
status = status[:len(status)-1] // Removing trailing new line
tokens := strings.Split(status, "\n")
for _, t := range tokens {
tt := strings.Split(t, "\t")
num, err := strconv.Atoi(tt[1])
if err != nil {
info[tt[0]] = tt[1]
} else {
info[tt[0]] = num
}
}
return info
}
func (s *Storage) Close() (err error) {
if err = s.kyoto.Sync(true); err != nil {
return