diff --git a/.gitignore b/.gitignore index 11424f8..bd58fa1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *.db -*.sqlite \ No newline at end of file +*.sqlite +build/ \ No newline at end of file diff --git a/cmd/main.go b/cmd/main.go index c3bdfee..404e826 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -15,7 +15,7 @@ func main() { // Setup AppContext var appContext = helpers.SetupAppContext() - ticker := time.NewTicker(1 * time.Minute) + ticker := time.NewTicker(10 * time.Minute) runFetchPosts := func() { // Get posts @@ -50,6 +50,10 @@ func main() { runFetchPosts() } }() + // Run initial fetch on startup + go func() { + runFetchPosts() + }() // https://seefnasrul.medium.com/create-your-first-go-rest-api-with-jwt-authentication-in-gin-framework-dbe5bda72817 engine := gin.Default()