mirror of
https://github.com/go-gitea/gitea.git
synced 2025-07-22 13:25:21 +02:00
chore: rename to Init
This commit is contained in:
parent
9b021500b0
commit
745be45e1b
@ -11,11 +11,18 @@ import (
|
|||||||
|
|
||||||
"code.gitea.io/gitea/models/webhook"
|
"code.gitea.io/gitea/models/webhook"
|
||||||
"code.gitea.io/gitea/modules/git"
|
"code.gitea.io/gitea/modules/git"
|
||||||
|
"code.gitea.io/gitea/modules/graceful"
|
||||||
"code.gitea.io/gitea/modules/log"
|
"code.gitea.io/gitea/modules/log"
|
||||||
|
"code.gitea.io/gitea/modules/queue"
|
||||||
|
|
||||||
"github.com/nektos/act/pkg/model"
|
"github.com/nektos/act/pkg/model"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func Init() {
|
||||||
|
jobEmitterQueue = queue.CreateUniqueQueue("bots_ready_job", jobEmitterQueueHandle, new(jobUpdate))
|
||||||
|
go graceful.GetManager().RunWithShutdownFns(jobEmitterQueue.Run)
|
||||||
|
}
|
||||||
|
|
||||||
func ListWorkflows(commit *git.Commit) (git.Entries, error) {
|
func ListWorkflows(commit *git.Commit) (git.Entries, error) {
|
||||||
tree, err := commit.SubTree(".gitea/workflows")
|
tree, err := commit.SubTree(".gitea/workflows")
|
||||||
if _, ok := err.(git.ErrNotExist); ok {
|
if _, ok := err.(git.ErrNotExist); ok {
|
||||||
|
@ -23,11 +23,6 @@ type jobUpdate struct {
|
|||||||
RunID int64
|
RunID int64
|
||||||
}
|
}
|
||||||
|
|
||||||
func InitJobEmitter() {
|
|
||||||
jobEmitterQueue = queue.CreateUniqueQueue("bots_ready_job", jobEmitterQueueHandle, new(jobUpdate))
|
|
||||||
go graceful.GetManager().RunWithShutdownFns(jobEmitterQueue.Run)
|
|
||||||
}
|
|
||||||
|
|
||||||
func EmitJobsIfReady(runID int64) error {
|
func EmitJobsIfReady(runID int64) error {
|
||||||
err := jobEmitterQueue.Push(&jobUpdate{
|
err := jobEmitterQueue.Push(&jobUpdate{
|
||||||
RunID: runID,
|
RunID: runID,
|
||||||
|
@ -175,7 +175,7 @@ func GlobalInitInstalled(ctx context.Context) {
|
|||||||
auth.Init()
|
auth.Init()
|
||||||
svg.Init()
|
svg.Init()
|
||||||
|
|
||||||
bots.InitJobEmitter()
|
bots.Init()
|
||||||
|
|
||||||
// Finally start up the cron
|
// Finally start up the cron
|
||||||
cron.NewContext(ctx)
|
cron.NewContext(ctx)
|
||||||
|
@ -12,13 +12,14 @@ import (
|
|||||||
"code.gitea.io/gitea/models/db"
|
"code.gitea.io/gitea/models/db"
|
||||||
"code.gitea.io/gitea/modules/log"
|
"code.gitea.io/gitea/modules/log"
|
||||||
"code.gitea.io/gitea/modules/timeutil"
|
"code.gitea.io/gitea/modules/timeutil"
|
||||||
|
|
||||||
runnerv1 "gitea.com/gitea/proto-go/runner/v1"
|
runnerv1 "gitea.com/gitea/proto-go/runner/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
zombieTaskTimeout = 10 * time.Minute
|
zombieTaskTimeout = 10 * time.Minute
|
||||||
endlessTaskTimeout = 3 * time.Hour // the task is running for a long time with updates
|
endlessTaskTimeout = 3 * time.Hour
|
||||||
abandonedJobTimeout = 24 * time.Hour // the job is waiting for being picked by a runner
|
abandonedJobTimeout = 24 * time.Hour
|
||||||
)
|
)
|
||||||
|
|
||||||
// StopZombieTasks stops the task which have running status, but haven't been updated for a long time
|
// StopZombieTasks stops the task which have running status, but haven't been updated for a long time
|
||||||
|
Loading…
x
Reference in New Issue
Block a user