From 2a9920391d145d96133ad9f41ce13d1c0b1ad75c Mon Sep 17 00:00:00 2001 From: Frank Elsinga Date: Tue, 19 Sep 2023 18:35:45 +0200 Subject: [PATCH] added context --- server/backend/movie.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/backend/movie.go b/server/backend/movie.go index 01bc2940..71be0023 100644 --- a/server/backend/movie.go +++ b/server/backend/movie.go @@ -11,9 +11,9 @@ import ( "google.golang.org/protobuf/types/known/timestamppb" ) -func (s *CampusServer) GetMovies(_ context.Context, req *pb.GetMoviesRequest) (*pb.GetMoviesReply, error) { +func (s *CampusServer) GetMovies(ctx context.Context, req *pb.GetMoviesRequest) (*pb.GetMoviesReply, error) { var movies []model.Kino - if err := s.db.Joins("Files").Find(&movies, "kino > ?", req.LastId).Error; err != nil { + if err := s.db.WithContext(ctx).Joins("Files").Find(&movies, "kino > ?", req.LastId).Error; err != nil { log.WithError(err).Error("Error while fetching movies from database") return nil, status.Error(codes.Internal, "Error while fetching movies from database") }