diff options
author | Ben Johnson <benbjohnson@yahoo.com> | 2014-06-24 11:56:55 -0600 |
---|---|---|
committer | Ben Johnson <benbjohnson@yahoo.com> | 2014-06-24 11:56:55 -0600 |
commit | 283c556aa83421c6954a6c0af0358b26c1c7cafa (patch) | |
tree | 4550fc51889f26df3d5087714fd917288a5c6ee7 | |
parent | Merge pull request #212 from Shopify/stats_sub (diff) | |
parent | review tweaks (diff) | |
download | dedo-283c556aa83421c6954a6c0af0358b26c1c7cafa.tar.gz dedo-283c556aa83421c6954a6c0af0358b26c1c7cafa.tar.xz |
Merge pull request #213 from Shopify/stats_sub2
Drop the *s guard in Stats.Sub()
-rw-r--r-- | db.go | 14 |
1 files changed, 3 insertions, 11 deletions
@@ -575,19 +575,11 @@ type Stats struct { // This is useful when obtaining stats at two different points and time and // you need the performance counters that occurred within that time span. func (s *Stats) Sub(other *Stats) Stats { - var diff Stats - if s == nil { - if other == nil { - return diff - } else { - return *other - } - } - diff = *s if other == nil { - return diff + return *s } - diff.TxN = other.TxN - diff.TxN + var diff Stat + diff.TxN = other.TxN - s.TxN diff.TxStats = s.TxStats.Sub(&other.TxStats) return diff } |