incorporate channel updateAt into channel counts and pull channel data on channel update

Этот коммит содержится в:
JoramWilander
2015-08-11 08:20:17 -04:00
родитель 6c0fefad15
Коммит 4ec76e059c
5 изменённых файлов: 22 добавлений и 11 удалений

Просмотреть файл

@@ -11,7 +11,8 @@ import (
)
type ChannelCounts struct {
Counts map[string]int64 `json:"counts"`
Counts map[string]int64 `json:"counts"`
UpdateTimes map[string]int64 `json:"update_times"`
}
func (o *ChannelCounts) Etag() string {
@@ -20,9 +21,16 @@ func (o *ChannelCounts) Etag() string {
str += id + strconv.FormatInt(count, 10)
}
data := []byte(str)
md5Counts := md5.Sum([]byte(str))
return Etag(md5.Sum(data))
var update int64 = 0
for _, u := range o.UpdateTimes {
if u > update {
update = u
}
}
return Etag(md5Counts, update)
}
func (o *ChannelCounts) ToJson() string {