This commit is contained in:
skeris 2024-12-02 21:45:54 +03:00
parent 75870273bd
commit a7596ff33d
2 changed files with 5 additions and 1 deletions

@ -21,6 +21,7 @@ import (
"errors" "errors"
"penahub.gitlab.yandexcloud.net/backend/quiz/common.git/dal" "penahub.gitlab.yandexcloud.net/backend/quiz/common.git/dal"
"time" "time"
"fmt"
"go.uber.org/zap" "go.uber.org/zap"
) )
@ -28,7 +29,7 @@ import (
func Run(ctx context.Context, config initialize.Config, logger *zap.Logger) error { func Run(ctx context.Context, config initialize.Config, logger *zap.Logger) error {
defer func() { defer func() {
if r := recover(); r != nil { if r := recover(); r != nil {
logger.Error("Recovered from a panic", zap.Any("error", r)) logger.Error("Recovered in app from a panic", zap.Any("error", r))
} }
}() }()
@ -135,6 +136,7 @@ func Run(ctx context.Context, config initialize.Config, logger *zap.Logger) erro
go dataUpdater.Start(ctx) go dataUpdater.Start(ctx)
go queUpdater.Start(ctx) go queUpdater.Start(ctx)
fmt.Println("UMBRELLA")
go dealsPoster.Start(ctx) go dealsPoster.Start(ctx)
go fieldsPoster.Start(ctx) go fieldsPoster.Start(ctx)

@ -45,6 +45,7 @@ func NewPostDealsWC(deps Deps) *PostDeals {
} }
func (wc *PostDeals) Start(ctx context.Context) { func (wc *PostDeals) Start(ctx context.Context) {
fmt.Println("Start")
ticker := time.NewTicker(1 * time.Minute) ticker := time.NewTicker(1 * time.Minute)
defer ticker.Stop() defer ticker.Stop()
defer func() { defer func() {
@ -60,6 +61,7 @@ func (wc *PostDeals) Start(ctx context.Context) {
wc.startFetching(ctx) wc.startFetching(ctx)
case <-ctx.Done(): case <-ctx.Done():
fmt.Println("Done")
return return
} }
} }