Chore: Remove context.TODO (#43458)

* Remove context.TODO() from services

* Fix live test
This commit is contained in:
idafurjes
2021-12-28 10:26:18 +01:00
committed by GitHub
parent 56b3dc5445
commit 56c3875bb9
24 changed files with 81 additions and 77 deletions
+4 -4
View File
@@ -170,7 +170,7 @@ func NewNamespaceStream(orgID int64, scope string, namespace string, publisher m
// Push sends frame to the stream and saves it for later retrieval by subscribers.
// * Saves the entire frame to cache.
// * If schema has been changed sends entire frame to channel, otherwise only data.
func (s *NamespaceStream) Push(path string, frame *data.Frame) error {
func (s *NamespaceStream) Push(ctx context.Context, path string, frame *data.Frame) error {
jsonFrameCache, err := data.FrameToJSONCache(frame)
if err != nil {
return err
@@ -179,7 +179,7 @@ func (s *NamespaceStream) Push(path string, frame *data.Frame) error {
// The channel this will be posted into.
channel := live.Channel{Scope: s.scope, Namespace: s.namespace, Path: path}.String()
isUpdated, err := s.frameCache.Update(s.orgID, channel, jsonFrameCache)
isUpdated, err := s.frameCache.Update(ctx, s.orgID, channel, jsonFrameCache)
if err != nil {
logger.Error("Error updating managed stream schema", "error", err)
return err
@@ -238,9 +238,9 @@ func (s *NamespaceStream) GetHandlerForPath(_ string) (models.ChannelHandler, er
return s, nil
}
func (s *NamespaceStream) OnSubscribe(_ context.Context, u *models.SignedInUser, e models.SubscribeEvent) (models.SubscribeReply, backend.SubscribeStreamStatus, error) {
func (s *NamespaceStream) OnSubscribe(ctx context.Context, u *models.SignedInUser, e models.SubscribeEvent) (models.SubscribeReply, backend.SubscribeStreamStatus, error) {
reply := models.SubscribeReply{}
frameJSON, ok, err := s.frameCache.GetFrame(u.OrgId, e.Channel)
frameJSON, ok, err := s.frameCache.GetFrame(ctx, u.OrgId, e.Channel)
if err != nil {
return reply, 0, err
}