diff options
| author | Mason Reed <mason@vector35.com> | 2025-01-31 13:09:15 -0500 |
|---|---|---|
| committer | Mason Reed <mason@vector35.com> | 2025-01-31 16:17:30 -0500 |
| commit | 18dde29a06847598d97a5166e3badb14a779c001 (patch) | |
| tree | f6e3f441b947485a58de62e759237a904a816b99 /rust/src/enterprise.rs | |
| parent | d0379d3139a3d60351a49425469d7672f69542ad (diff) | |
Add lock on enterprise checkout code in Rust API
This is being done as a preventative measure against possible races in checkout code. This is more so just peace of mind, the enterprise code that is touched in this function only locks on a single mutex so this is probably useless, but I would rather have this assurance than have to debug some issue in this code.
Diffstat (limited to 'rust/src/enterprise.rs')
| -rw-r--r-- | rust/src/enterprise.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/rust/src/enterprise.rs b/rust/src/enterprise.rs index 34fa8a03..aecbf974 100644 --- a/rust/src/enterprise.rs +++ b/rust/src/enterprise.rs @@ -25,6 +25,10 @@ pub fn checkout_license(duration: Duration) -> Result<(), EnterpriseCheckoutErro return Ok(()); } + // The disparate core functions we call here might already have mutexes to guard. + static CHECKOUT_MUTEX: std::sync::Mutex<()> = std::sync::Mutex::new(()); + let _mtx = CHECKOUT_MUTEX.lock().unwrap(); + #[allow(clippy::collapsible_if)] if !is_server_initialized() { // We need to first initialize the server. |
