@@ -44,8 +44,8 @@ const (
4444
4545type resourceServiceInterface interface {
4646 AddInstances (instanceList []* mpi.Instance ) * mpi.Resource
47- UpdateInstances (instanceList []* mpi.Instance ) * mpi.Resource
48- DeleteInstances (instanceList []* mpi.Instance ) * mpi.Resource
47+ UpdateInstances (ctx context. Context , instanceList []* mpi.Instance ) * mpi.Resource
48+ DeleteInstances (ctx context. Context , instanceList []* mpi.Instance ) * mpi.Resource
4949 ApplyConfig (ctx context.Context , instanceID string ) error
5050 Instance (instanceID string ) * mpi.Instance
5151 GetHTTPUpstreamServers (ctx context.Context , instance * mpi.Instance , upstreams string ) ([]client.UpstreamServer ,
@@ -128,7 +128,7 @@ func (r *ResourceService) RemoveOperator(instanceList []*mpi.Instance) {
128128 }
129129}
130130
131- func (r * ResourceService ) UpdateInstances (instanceList []* mpi.Instance ) * mpi.Resource {
131+ func (r * ResourceService ) UpdateInstances (ctx context. Context , instanceList []* mpi.Instance ) * mpi.Resource {
132132 r .resourceMutex .Lock ()
133133 defer r .resourceMutex .Unlock ()
134134
@@ -144,14 +144,15 @@ func (r *ResourceService) UpdateInstances(instanceList []*mpi.Instance) *mpi.Res
144144 }
145145 r .resource = resourceCopy
146146 } else {
147- slog .Warn ("Error updating resource instances" , "instances" , instanceList )
147+ slog .WarnContext (ctx , "Unable to clone resource while updating instances" , "resource" ,
148+ r .resource , "instances" , instanceList )
148149 }
149150 }
150151
151152 return r .resource
152153}
153154
154- func (r * ResourceService ) DeleteInstances (instanceList []* mpi.Instance ) * mpi.Resource {
155+ func (r * ResourceService ) DeleteInstances (ctx context. Context , instanceList []* mpi.Instance ) * mpi.Resource {
155156 r .resourceMutex .Lock ()
156157 defer r .resourceMutex .Unlock ()
157158
@@ -164,7 +165,8 @@ func (r *ResourceService) DeleteInstances(instanceList []*mpi.Instance) *mpi.Res
164165 }
165166 }
166167 } else {
167- slog .Warn ("Error deleting instances from resource" , "instances" , instanceList )
168+ slog .WarnContext (ctx , "Unable to clone resource while deleting instances" , "resource" ,
169+ r .resource , "instances" , instanceList )
168170 }
169171 }
170172 r .RemoveOperator (instanceList )
0 commit comments