mirror of https://github.com/JustKato/FreePad.git
+ Experimenting with Tasks
This commit is contained in:
parent
01c2654add
commit
a3de00aabd
|
@ -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
|
||||||
|
})
|
||||||
|
}
|
4
main.go
4
main.go
|
@ -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()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue