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

Add 3 second local lock #835

Closed
wants to merge 1 commit into from
Closed

Add 3 second local lock #835

wants to merge 1 commit into from

Conversation

benthecarman
Copy link
Collaborator

Adds a 3 second lock on the local device, this is to hopefully prevent a second instance of mutiny being created on the same device.

Currently what this does is just throw the AlreadyRunning, alternatively what we could do is just loop and keep checking until the lock is gone, this way if the user quickly closes and quickly re-opens they won't have a chance of running into this error.

This interval is short enough where if I refresh the page I am not running into it.

@@ -86,7 +86,7 @@ impl DeviceLock {
/// This is determined if the time is less than 2 minutes ago
pub fn is_locked(&self, id: &str) -> bool {
let now = now().as_secs();
let diff = now - self.time as u64;
let diff = now.saturating_sub(self.time as u64);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doubt it but maybe this will fix some edge case bug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant