From 9ec7b633fae02850c345ed4fdefb210acd8af7d5 Mon Sep 17 00:00:00 2001 From: Alex Snaps Date: Tue, 8 Oct 2024 12:05:34 -0400 Subject: [PATCH] Reuse the same connection to load script Signed-off-by: Alex Snaps --- limitador/src/storage/redis/redis_async.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/limitador/src/storage/redis/redis_async.rs b/limitador/src/storage/redis/redis_async.rs index 39176eac..cc7c1cf3 100644 --- a/limitador/src/storage/redis/redis_async.rs +++ b/limitador/src/storage/redis/redis_async.rs @@ -133,13 +133,13 @@ impl AsyncCounterStorage for AsyncRedisStorage { .await { if err.kind() == ErrorKind::NoScriptError { - self.load_script(SCRIPT_UPDATE_COUNTER).await?; + script.prepare_invoke().load_async(&mut con).await?; pipeline .query_async::<()>(&mut con) .instrument(info_span!("datastore")) - .await? + .await?; } else { - Err(err)? + Err(err)?; } }