From 3dc0ea7524f4a19c1cedf68477b1a0ab0651953b Mon Sep 17 00:00:00 2001 From: Zack Scholl Date: Mon, 14 Mar 2016 15:26:55 -0400 Subject: [PATCH] Open DB only when needed --- routes.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/routes.go b/routes.go index 1d5db91..a057c81 100644 --- a/routes.go +++ b/routes.go @@ -380,6 +380,8 @@ func deletePage(c *gin.Context) { } func listEverything() string { + Open(RuntimeArgs.DatabaseLocation) + defer Close() everything := `| Title | Current size | Changes | Total Size | | | --------- |-------------| -----| ------------- | ------------- | ` @@ -403,6 +405,8 @@ func listEverything() string { } func dumpEverything() { + Open(RuntimeArgs.DatabaseLocation) + defer Close() err := os.MkdirAll("dump", 0777) if err != nil { fmt.Println("Already exists")