1
0
mirror of https://github.com/schollz/cowyo.git synced 2023-08-10 21:13:00 +03:00

Open DB only when needed

This commit is contained in:
Zack Scholl 2016-03-14 15:26:55 -04:00
parent b767dd0352
commit 3dc0ea7524

View File

@ -380,6 +380,8 @@ func deletePage(c *gin.Context) {
} }
func listEverything() string { func listEverything() string {
Open(RuntimeArgs.DatabaseLocation)
defer Close()
everything := `| Title | Current size | Changes | Total Size | | everything := `| Title | Current size | Changes | Total Size | |
| --------- |-------------| -----| ------------- | ------------- | | --------- |-------------| -----| ------------- | ------------- |
` `
@ -403,6 +405,8 @@ func listEverything() string {
} }
func dumpEverything() { func dumpEverything() {
Open(RuntimeArgs.DatabaseLocation)
defer Close()
err := os.MkdirAll("dump", 0777) err := os.MkdirAll("dump", 0777)
if err != nil { if err != nil {
fmt.Println("Already exists") fmt.Println("Already exists")