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 exclusive locks to channels sqlite db #781

Merged
merged 3 commits into from
Jan 3, 2019
Merged

Add exclusive locks to channels sqlite db #781

merged 3 commits into from
Jan 3, 2019

Conversation

pm47
Copy link
Member

@pm47 pm47 commented Dec 13, 2018

Note that there is no risk of corruption currently (concurrent writes would just fail with SQLITE_BUSY), but with this we make sure that there is only one instance of eclair using the same eclair.sqlite db file at any time.

From https://www.sqlite.org/pragma.html:

There are three reasons to set the locking-mode to EXCLUSIVE.

  1. The application wants to prevent other processes from accessing the database file.
  2. [...]
  3. [...]

@@ -41,6 +41,8 @@ trait AuditDb {

def stats: Seq[Stats]

def close: Unit
Copy link
Member

Choose a reason for hiding this comment

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

Scala convention would be to use close() since this methods has side-effects

@pm47 pm47 merged commit 9da3304 into master Jan 3, 2019
@pm47 pm47 deleted the lock-sqlite branch January 3, 2019 10:01
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.

None yet

2 participants