Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicitly drop lock in Sessions.rs #72

Merged
merged 1 commit into from
Feb 17, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/sessions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,10 @@ fn ingest_from_pubsub(map: Arc<RwLock<HashMap<String, u64>>>) {
},
None => {},
};

// Explicitly drop map write lock here (locks are automatically dropped
// when they fall out of scope but this is more clear.)
drop(mmap);
continue
}

Expand All @@ -373,7 +377,8 @@ fn ingest_from_pubsub(map: Arc<RwLock<HashMap<String, u64>>>) {
// Insert
*mmap.entry(key).or_insert(expire_time) = expire_time;

// Get rid of writable reference to map.
// Get rid of writable reference to map. (locks are automatically dropped
// when they fall out of scope but this is more clear.)
drop(mmap);

debug!("Added registered ip {} from redis", sd);
Expand Down