diff options
Diffstat (limited to 'model/channel_count.go')
-rw-r--r-- | model/channel_count.go | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/model/channel_count.go b/model/channel_count.go index 05d8401e1..f53e6acaf 100644 --- a/model/channel_count.go +++ b/model/channel_count.go @@ -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 { |