fix: avoid lock reentry

This commit is contained in:
Qu Xuan
2020-11-10 21:13:55 +08:00
parent 097d1af288
commit cfebba2557
2 changed files with 2 additions and 0 deletions
+1
View File
@@ -41,6 +41,7 @@ const (
APP_CONTEXT_KEY_OBJECT_ID = AppContextKey("objectid")
APP_CONTEXT_KEY_OBJECT_TYPE = AppContextKey("objecttype")
APP_CONTEXT_KEY_START_TIME = AppContextKey("starttime")
APP_CONTEXT_KEY_TASKNAME = AppContextKey("taskname")
APP_CONTEXT_KEY_HOST_ID = AppContextKey("hostid")
+1
View File
@@ -393,6 +393,7 @@ func (job *SCronJob) runJobInWorker(isStart bool) {
log.Debugf("Cron job: %s started", job.Name)
ctx := context.Background()
ctx = context.WithValue(ctx, appctx.APP_CONTEXT_KEY_APPNAME, "Cron-Service")
ctx = context.WithValue(ctx, appctx.APP_CONTEXT_KEY_TASKNAME, job.Name)
userCred := DefaultAdminSessionGenerator()
job.job(ctx, userCred, isStart)
}