Skip to content

Commit

Permalink
[refactor] Replace write lock by read lock
Browse files Browse the repository at this point in the history
* Ready for multi thread
  • Loading branch information
didierofrivia committed Aug 24, 2023
1 parent 065165e commit dd5ffd0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion limitador/src/storage/in_memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ impl CounterStorage for InMemoryStorage {
delta: i64,
load_counters: bool,
) -> Result<Authorization, StorageErr> {
let limits_by_namespace = self.limits_for_namespace.write().unwrap();
let limits_by_namespace = self.limits_for_namespace.read().unwrap();
let mut first_limited = None;
let mut counter_values_to_update: Vec<(&AtomicExpiringValue, Counter)> = Vec::new();
let mut qualified_counter_values_to_updated: Vec<(Arc<AtomicExpiringValue>, Counter)> =
Expand Down

0 comments on commit dd5ffd0

Please sign in to comment.