Skip to content

Commit 0f57f4f

Browse files
committed
polishing
1 parent d5cd234 commit 0f57f4f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

splitio/engine/impressions/adapters.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,13 @@ def flush_counters(self, to_send):
9494
:type to_send: Dictionary {'feature1': set(), 'feature2': set(), .. }
9595
"""
9696
try:
97+
resulted = 0
98+
counted = 0
9799
for pf_count in to_send:
98100
self.pipe.hincrby(self.IMP_COUNT_QUEUE_KEY, pf_count.feature + "::" + str(pf_count.timeframe), pf_count.count)
99-
result = self.pipe.execute()
100-
self._expire_keys(self.IMP_COUNT_QUEUE_KEY, self.IMP_COUNT_KEY_DEFAULT_TTL, result[0], pf_count.count)
101+
counted += pf_count.count
102+
resulted = sum(self.pipe.execute())
103+
self._expire_keys(self.IMP_COUNT_QUEUE_KEY, self.IMP_COUNT_KEY_DEFAULT_TTL, resulted, counted)
101104
return True
102105
except RedisAdapterException:
103106
_LOGGER.error('Something went wrong when trying to add counters to redis')

0 commit comments

Comments
 (0)