chore(gRPC): handle requesut for stage data

Signed-off-by: Bo-Yi.Wu <appleboy.tw@gmail.com>
This commit is contained in:
Bo-Yi.Wu
2022-09-03 15:58:58 +08:00
committed by Jason Song
parent eac6425b2f
commit ea0cf8515e
7 changed files with 289 additions and 2 deletions

View File

@ -0,0 +1,37 @@
// Copyright 2022 The Gitea Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package queue
import (
"context"
"time"
"code.gitea.io/gitea/routers/api/bots/core"
)
type scheduler struct {
*queue
}
// New creates a new scheduler.
func New() core.Scheduler {
return scheduler{
queue: newQueue(),
}
}
// newQueue returns a new Queue backed by the build datastore.
func newQueue() *queue {
q := &queue{
ready: make(chan struct{}, 1),
workers: map[*worker]struct{}{},
interval: time.Minute,
ctx: context.Background(),
}
go func() {
_ = q.start()
}()
return q
}