-
Notifications
You must be signed in to change notification settings - Fork 323
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix for SQLite DB busy error on Azure (#1395)
depending on an environmental variable is used either default locking mode or a mode that uses flock syscall
- Loading branch information
1 parent
8f8ec81
commit 0010ba7
Showing
8 changed files
with
119 additions
and
33 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
engine/language-server/src/main/scala/org/enso/languageserver/boot/DeploymentType.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package org.enso.languageserver.boot | ||
|
||
/** Signal where the lang. server is deployed. | ||
*/ | ||
sealed trait DeploymentType | ||
|
||
object DeploymentType { | ||
|
||
/** Desktop deployment. | ||
*/ | ||
case object Desktop extends DeploymentType | ||
|
||
/** Azure deployment. | ||
*/ | ||
case object Azure extends DeploymentType | ||
|
||
/** Determines the current deployment type from environment variables. | ||
* @return the current deployment type | ||
*/ | ||
def fromEnvironment(): DeploymentType = { | ||
if (sys.env.contains(DeploymentTypeVariableName)) { | ||
val value = sys.env(DeploymentTypeVariableName) | ||
fromString(value) | ||
} else { | ||
Desktop | ||
} | ||
} | ||
|
||
/** Determines a current deployment type from a string value. | ||
* @return a deployment type | ||
*/ | ||
def fromString(value: String): DeploymentType = | ||
value.toLowerCase.trim match { | ||
case "desktop" | "" => Desktop | ||
case "azure" => Azure | ||
} | ||
|
||
private lazy val DeploymentTypeVariableName = "DEPLOYMENT_TYPE" | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
lib/scala/searcher/src/main/scala/org/enso/searcher/sqlite/LockingMode.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package org.enso.searcher.sqlite | ||
|
||
/** A mode used to handle file locking in SQLite */ | ||
case class LockingMode private (name: String) | ||
|
||
object LockingMode { | ||
|
||
/** Default mode that uses POSIX advisory locks. | ||
*/ | ||
val UnixPosix = LockingMode("unix") | ||
|
||
/** It obtains and holds an exclusive lock on database files, | ||
* preventing other processes from accessing the database. | ||
* It uses the `flock` system call. | ||
*/ | ||
val UnixFlock = LockingMode("unix-excl") | ||
|
||
/** It uses dot-file locking rather than POSIX advisory locks. */ | ||
val UnixDotFile = LockingMode("unix-dotfile") | ||
|
||
/** All file locking operations are no-ops. */ | ||
val UnixNone = LockingMode("unix-none") | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters