@@ -32,6 +32,7 @@ import (
3232 "yunion.io/x/onecloud/pkg/mcclient/auth"
3333 "yunion.io/x/onecloud/pkg/mcclient/informer"
3434 modules "yunion.io/x/onecloud/pkg/mcclient/modules/identity"
35+ "yunion.io/x/onecloud/pkg/util/ctx"
3536 "yunion.io/x/onecloud/pkg/util/stringutils2"
3637)
3738
@@ -192,7 +193,7 @@ func (manager *SRoleCacheManager) OnAdd(obj *jsonutils.JSONDict) {
192193 log .Errorf ("unable to get Id: %v" , err )
193194 return
194195 }
195- ctx := context . Background ()
196+ ctx := ctx . CtxWithTime ()
196197 lockman .LockRawObject (ctx , manager .KeywordPlural (), id )
197198 defer lockman .ReleaseRawObject (ctx , manager .KeywordPlural (), id )
198199 role := new (SRole )
@@ -212,7 +213,7 @@ func (manager *SRoleCacheManager) OnUpdate(oldObj, newObj *jsonutils.JSONDict) {
212213 log .Errorf ("unable to get Id: %v" , err )
213214 return
214215 }
215- ctx := context . Background ()
216+ ctx := ctx . CtxWithTime ()
216217 role , err := manager .fetchRole (ctx , id , true , nil )
217218 if err != nil {
218219 log .Errorf ("unable to fetch Role from db: %v" , err )
@@ -242,7 +243,7 @@ func (manager *SRoleCacheManager) OnDelete(obj *jsonutils.JSONDict) {
242243 log .Errorf ("unable to get Id: %v" , err )
243244 return
244245 }
245- ctx := context . Background ()
246+ ctx := ctx . CtxWithTime ()
246247 role , err := manager .fetchRole (ctx , id , true , nil )
247248 if err != nil {
248249 log .Errorf ("unable to fetch Role from db: %v" , err )
@@ -263,7 +264,7 @@ func (manager *SRoleCacheManager) StartWatchRoleInKeystone() error {
263264 if manager .watching {
264265 return nil
265266 }
266- ctx := context . Background ()
267+ ctx := ctx . CtxWithTime ()
267268 s := auth .GetAdminSession (ctx , "" )
268269 watchMan , err := informer .NewWatchManagerBySession (s )
269270 if err != nil {
0 commit comments