filter by learning_types and course_thematics
This commit is contained in:
@ -16,6 +16,7 @@ import (
|
||||
"git.loyso.art/frx/kurious/internal/kurious/adapters"
|
||||
xhttp "git.loyso.art/frx/kurious/internal/kurious/ports/http"
|
||||
"git.loyso.art/frx/kurious/internal/kurious/service"
|
||||
|
||||
"golang.org/x/sync/errgroup"
|
||||
)
|
||||
|
||||
@ -88,26 +89,30 @@ func app(ctx context.Context) error {
|
||||
slog.String("addr", httpServer.Addr),
|
||||
)
|
||||
|
||||
err := httpServer.ListenAndServe()
|
||||
if err != nil {
|
||||
if err := httpServer.ListenAndServe(); err != nil {
|
||||
if !errors.Is(err, http.ErrServerClosed) {
|
||||
return fmt.Errorf("listening http: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
})
|
||||
|
||||
eg.Go(func() error {
|
||||
<-egctx.Done()
|
||||
|
||||
xcontext.LogInfo(ctx, log, "trying to shutdown http")
|
||||
|
||||
sdctx, sdcancel := context.WithTimeout(context.Background(), time.Second*10)
|
||||
defer sdcancel()
|
||||
|
||||
err := httpServer.Shutdown(sdctx)
|
||||
if err != nil {
|
||||
return fmt.Errorf("shutting down the server: %w", err)
|
||||
}
|
||||
|
||||
xcontext.LogInfo(ctx, log, "server closed successfuly")
|
||||
|
||||
return nil
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user