Skip to content

Commit

Permalink
Merge pull request #359 from Kuadrant/nightly
Browse files Browse the repository at this point in the history
Nightly
  • Loading branch information
alexsnaps authored Jul 2, 2024
2 parents 87fd451 + 1e5433c commit 53e1465
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
6 changes: 3 additions & 3 deletions limitador/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@
//!
//! The definition of a limit includes:
//! - A namespace that identifies the resource to limit. It could be an API, a
//! Kubernetes service, a proxy ID, etc.
//! Kubernetes service, a proxy ID, etc.
//! - A value.
//! - The length of the period in seconds.
//! - Conditions that define when to apply the limit.
//! - A set of variables. For example, if we need to define the same limit for
//! each "user_id", instead of creating a limit for each hardcoded ID, we just
//! need to define "user_id" as a variable.
//! each "user_id", instead of creating a limit for each hardcoded ID, we just
//! need to define "user_id" as a variable.
//!
//! If we used Limitador in a context where it receives an HTTP request we could
//! define a limit like this to allow 10 requests per minute and per user_id
Expand Down
6 changes: 3 additions & 3 deletions limitador/src/storage/redis/redis_async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ impl AsyncCounterStorage for AsyncRedisStorage {
.key(key_for_counters_of_limit(counter.limit()))
.arg(counter.window().as_secs())
.arg(delta)
.invoke_async::<_, _>(&mut con)
.invoke_async::<_, ()>(&mut con)
.instrument(info_span!("datastore"))
.await?;

Expand Down Expand Up @@ -191,7 +191,7 @@ impl AsyncCounterStorage for AsyncRedisStorage {
async fn clear(&self) -> Result<(), StorageErr> {
let mut con = self.conn_manager.clone();
redis::cmd("FLUSHDB")
.query_async(&mut con)
.query_async::<_, ()>(&mut con)
.instrument(info_span!("datastore"))
.await?;
Ok(())
Expand Down Expand Up @@ -224,7 +224,7 @@ impl AsyncRedisStorage {
};

for counter_key in counter_keys {
con.del(counter_key)
con.del::<_, ()>(counter_key)
.instrument(info_span!("datastore"))
.await?;
}
Expand Down
3 changes: 1 addition & 2 deletions limitador/src/storage/redis/redis_cached.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,9 +356,8 @@ async fn flush_batcher_and_update_counters<C: ConnectionLike>(
update_counters(&mut redis_conn, counters)
})
.await
.map(|res| {
.inspect(|_| {
flip_partitioned(&partitioned, false);
res
})
.or_else(|(data, err)| {
if err.is_transient() {
Expand Down
6 changes: 3 additions & 3 deletions limitador/src/storage/redis/redis_sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ impl CounterStorage for RedisStorage {
.key(key_for_counters_of_limit(counter.limit()))
.arg(counter.window().as_secs())
.arg(delta)
.invoke(&mut *con)?;
.invoke::<()>(&mut *con)?;

Ok(())
}
Expand Down Expand Up @@ -101,7 +101,7 @@ impl CounterStorage for RedisStorage {
.key(key_for_counters_of_limit(counter.limit()))
.arg(counter.window().as_secs())
.arg(delta)
.invoke(&mut *con)?;
.invoke::<()>(&mut *con)?;
}

Ok(Authorization::Ok)
Expand Down Expand Up @@ -154,7 +154,7 @@ impl CounterStorage for RedisStorage {
con.smembers::<String, HashSet<String>>(key_for_counters_of_limit(limit.deref()))?;

for counter_key in counter_keys {
con.del(counter_key)?;
con.del::<_, ()>(counter_key)?;
}
}

Expand Down

0 comments on commit 53e1465

Please sign in to comment.