code.gitea.io/gitea@v1.21.7/services/actions/init.go (about)

     1  // Copyright 2022 The Gitea Authors. All rights reserved.
     2  // SPDX-License-Identifier: MIT
     3  
     4  package actions
     5  
     6  import (
     7  	"code.gitea.io/gitea/modules/graceful"
     8  	"code.gitea.io/gitea/modules/log"
     9  	"code.gitea.io/gitea/modules/queue"
    10  	"code.gitea.io/gitea/modules/setting"
    11  	notify_service "code.gitea.io/gitea/services/notify"
    12  )
    13  
    14  func Init() {
    15  	if !setting.Actions.Enabled {
    16  		return
    17  	}
    18  
    19  	jobEmitterQueue = queue.CreateUniqueQueue(graceful.GetManager().ShutdownContext(), "actions_ready_job", jobEmitterQueueHandler)
    20  	if jobEmitterQueue == nil {
    21  		log.Fatal("Unable to create actions_ready_job queue")
    22  	}
    23  	go graceful.GetManager().RunWithCancel(jobEmitterQueue)
    24  
    25  	notify_service.RegisterNotifier(NewNotifier())
    26  }