mirror of
https://github.com/4rkal/shortr.git
synced 2025-01-28 18:46:28 +02:00
load links after creating
This commit is contained in:
parent
37d5e4bb80
commit
435d098992
@ -48,10 +48,6 @@ func init() {
|
||||
panic(fmt.Sprintf("Failed to connect to database: %v", err))
|
||||
}
|
||||
|
||||
if err := loadLinksIntoMemory(); err != nil {
|
||||
panic(fmt.Sprintf("Failed to load links into memory: %v", err))
|
||||
}
|
||||
|
||||
_, err = db.Exec(`
|
||||
CREATE TABLE IF NOT EXISTS links (
|
||||
id VARCHAR(255) PRIMARY KEY,
|
||||
@ -59,6 +55,10 @@ func init() {
|
||||
clicks INTEGER NOT NULL DEFAULT 0
|
||||
)
|
||||
`)
|
||||
|
||||
if err := loadLinksIntoMemory(); err != nil {
|
||||
panic(fmt.Sprintf("Failed to load links into memory: %v", err))
|
||||
}
|
||||
if err != nil {
|
||||
log.Fatal("Error creating table: ", err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user