Increase post fetch interval and add initial fetch on startup

This commit is contained in:
2025-05-14 21:07:56 +03:30
parent 3007b41f0d
commit aded00daf1
2 changed files with 7 additions and 2 deletions

1
.gitignore vendored
View File

@@ -1,2 +1,3 @@
*.db
*.sqlite
build/

View File

@@ -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()