forked from pocketbase/pocketbase
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added split (sync and async) db connections pool
- Loading branch information
1 parent
e964b01
commit b9e257d
Showing
13 changed files
with
304 additions
and
127 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package core | ||
|
||
import ( | ||
"github.com/pocketbase/dbx" | ||
) | ||
|
||
func initPragmas(db *dbx.DB) error { | ||
// note: the busy_timeout pragma must be first because | ||
// the connection needs to be set to block on busy before WAL mode | ||
// is set in case it hasn't been already set by another connection | ||
_, err := db.NewQuery(` | ||
PRAGMA busy_timeout = 10000; | ||
PRAGMA journal_mode = WAL; | ||
PRAGMA journal_size_limit = 100000000; | ||
PRAGMA synchronous = NORMAL; | ||
PRAGMA foreign_keys = TRUE; | ||
`).Execute() | ||
|
||
return err | ||
} |
Oops, something went wrong.