Skip to content

Conversation

@petrubabalau
Copy link

No description provided.


async with self._lock:
current_rate = await self._run_pipeline(cache_key, pipeline)
redis_version = await self.redis_version()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we do this earlier? We don't need to query this every time. We only need this once per app.

redis_version = await self.redis_version()

if int(redis_version.split('.')[0]) < 7:
current_rate, *_ = await pipeline.incr(cache_key).execute()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It feels like you execute a pipeline twice. This might not be safe due to race conditions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants