Skip to content

Commit 8830ba7

Browse files
authored
feat: use concurrency for data seeding and create dummy data (#11)
1 parent 7d53be2 commit 8830ba7

File tree

5 files changed

+1010
-27
lines changed

5 files changed

+1010
-27
lines changed

cmd/main.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,27 @@ import (
66
"devtasker/internal/utils"
77
"fmt"
88
"os"
9+
"sync"
910
)
1011

1112
func main() {
13+
var wg sync.WaitGroup
14+
1215
db := utils.ConnectDb()
1316
utils.MigrateDb(db)
1417

1518
if os.Getenv("APP_ENV") != "production" {
16-
utils.SeedTasks(db)
19+
wg.Add(1)
20+
go func() {
21+
defer wg.Done()
22+
utils.SeedTasks(db)
23+
}()
1724
}
1825

1926
app := internal.App(db)
2027
app.Listen(":3000")
2128

2229
fmt.Println("App listen to port 3000!")
30+
31+
wg.Wait()
2332
}

0 commit comments

Comments
 (0)