@@ -55,11 +55,13 @@ class ValuesController(
5555 checkObject(userId, objectId)
5656 val to = optionalTo ? : DateTime .now()
5757 val months = CassandraUtils .monthsBetween(YearMonth (from), YearMonth (to))
58+
59+ // update stats
60+ statsLogic.incrementReadCounterAsync(objectId)
61+
5862 // stream the values
5963 cassandraObjectStreamer.stream(contentType, response, RawValue .csvHeaders,
6064 rawValueRepository.findByTimestampBetween(objectId.toInt(), months, from, to))
61- // update stats
62- statsLogic.incrementReadCounter(objectId)
6365
6466 }
6567
@@ -79,12 +81,13 @@ class ValuesController(
7981 // do the search
8082 val latest = rawValueRepository.findLatestValue(objectId, obj.creationdate!! , optionalBefore ? : DateTime .now())
8183
84+ // update stats
85+ statsLogic.incrementReadCounterAsync(objectId)
86+
8287 // stream the results
8388 cassandraObjectStreamer.stream(
8489 contentType, response, RawValue .csvHeaders,
8590 if (latest == null ) listOf () else listOf (latest))
86- // update stats
87- statsLogic.incrementReadCounter(objectId)
8891 }
8992
9093 @Protected
@@ -107,12 +110,14 @@ class ValuesController(
107110 val minutes = granularity.minutes
108111 val to = optionalTo ? : DateTime .now()
109112 val months = CassandraUtils .monthsBetween(YearMonth (from), YearMonth (to))
113+
114+ // update stats
115+ statsLogic.incrementReadCounterAsync(objectId)
116+
110117 // stream the results
111118 cassandraObjectStreamer.stream(
112119 contentType, response, Aggregation .csvHeaders,
113120 aggregationsRepository.findByTimestampBetween(minutes, objectId.toInt(), months, from, to))
114- // update stats
115- statsLogic.incrementReadCounter(objectId)
116121 }
117122
118123
0 commit comments