From bb0f0845a54da4371a9b125cd5dae2ea6a3e7a3c 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 Former-commit-id: 2809fdfbbe56c1697a8a4699a11608fdefc33ef1 [formerly f3c48188157385a09b4aa8377727808faea640fd] [formerly f2ce94925b7a89b53d4fae7d7bef000174a9b7d2 [formerly 3dc0ea7524f4a19c1cedf68477b1a0ab0651953b]] Former-commit-id: 6207c2b06c010c4056cdda511262ef5e66b938d7 [formerly 755e934bab151bb526062c0fd0f2378fe1100c90] Former-commit-id: a97aaa6e4146f587e3446a93caa4a2ad2bdb9e0c --- 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")