+ Experimenting with Tasks

This commit is contained in:
Daniel Legt 2022-05-19 01:55:14 +03:00
parent 01c2654add
commit a3de00aabd
2 changed files with 26 additions and 0 deletions

View File

@ -0,0 +1,22 @@
package controllers
import (
"time"
)
func TaskManager() {
// Run the migrations function
go handleMigrations()
for range time.Tick(time.Second * 5) {
// fmt.Printf("%s\n", time.Now().Format("02/01/2006 03:04 PM"))
}
}
func handleMigrations() {
time.AfterFunc(time.Second*30, func() {
// Run Migrations
})
}

View File

@ -3,6 +3,7 @@ package main
import ( import (
"os" "os"
"github.com/JustKato/FreePad/lib/controllers"
"github.com/JustKato/FreePad/lib/routes" "github.com/JustKato/FreePad/lib/routes"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
@ -13,6 +14,9 @@ func main() {
gin.SetMode(gin.ReleaseMode) gin.SetMode(gin.ReleaseMode)
} }
// Run the TaskManager
go controllers.TaskManager()
// Initialize the router // Initialize the router
router := gin.Default() router := gin.Default()