aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2024-12-29 13:41:07 +0100
committerPřemysl Eric Janouch <p@janouch.name>2024-12-29 13:41:07 +0100
commitce2e58b6bcdef7616d5426f3310ab09cdea92f32 (patch)
tree08fa382743a37b8951f8de370f611412970a067f /main.go
parentca462ac0056cfe434acc8b8faf50a439ce3f8c91 (diff)
downloadgallery-ce2e58b6bcdef7616d5426f3310ab09cdea92f32.tar.gz
gallery-ce2e58b6bcdef7616d5426f3310ab09cdea92f32.tar.xz
gallery-ce2e58b6bcdef7616d5426f3310ab09cdea92f32.zip
Fix extremely slow removals
Diffstat (limited to 'main.go')
-rw-r--r--main.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/main.go b/main.go
index 53306d7..0eb7382 100644
--- a/main.go
+++ b/main.go
@@ -94,10 +94,15 @@ func init() {
}
func openDB(directory string) error {
+ galleryDirectory = directory
+
var err error
db, err = sql.Open("sqlite3_custom", "file:"+filepath.Join(directory,
nameOfDB+"?_foreign_keys=1&_busy_timeout=1000"))
- galleryDirectory = directory
+ if err != nil {
+ return err
+ }
+ _, err = db.Exec(initializeSQL)
return err
}
@@ -303,10 +308,6 @@ func cmdInit(fs *flag.FlagSet, args []string) error {
return err
}
- if _, err := db.Exec(initializeSQL); err != nil {
- return err
- }
-
// XXX: There's technically no reason to keep images as symlinks,
// we might just keep absolute paths in the database as well.
if err := os.MkdirAll(