Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ai3
tools
tabacco
Commits
fa672dc2
Commit
fa672dc2
authored
Nov 18, 2021
by
ale
Browse files
Limit sqlite driver to 1 concurrent connection
See
https://github.com/mattn/go-sqlite3/issues/209
for reference.
parent
0a281cb6
Pipeline
#23956
passed with stages
in 1 minute and 57 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
metadb/server/sql.go
View file @
fa672dc2
...
...
@@ -20,7 +20,7 @@ import (
func
openDB
(
dbDriver
,
dbURI
string
)
(
*
sql
.
DB
,
error
)
{
if
dbDriver
==
"sqlite3"
&&
!
strings
.
Contains
(
dbURI
,
"?"
)
{
dbURI
+=
"?
cache=shared&
_busy_timeout=10000&_journal=WAL&_mutex=full"
dbURI
+=
"?_busy_timeout=10000&_journal=WAL&_mutex=full"
}
db
,
err
:=
sql
.
Open
(
dbDriver
,
dbURI
)
...
...
@@ -33,6 +33,10 @@ func openDB(dbDriver, dbURI string) (*sql.DB, error) {
return
nil
,
err
}
// Limit the pool to a single connection.
// https://github.com/mattn/go-sqlite3/issues/209
db
.
SetMaxOpenConns
(
1
)
return
db
,
nil
}
...
...
@@ -56,7 +60,7 @@ func runDatabaseMigrations(db *sql.DB, dbDriver string) error {
di
,
err
:=
msqlite3
.
WithInstance
(
db
,
&
msqlite3
.
Config
{
MigrationsTable
:
msqlite3
.
DefaultMigrationsTable
,
DatabaseName
:
"
usermetadb
"
,
DatabaseName
:
"
tabacco
"
,
})
if
err
!=
nil
{
return
err
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment