mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-12 12:15:00 +00:00
move arbitrary number into const (#4044)
This commit is contained in:
parent
b357ae7243
commit
886061fb2f
1 changed files with 3 additions and 1 deletions
|
@ -39,6 +39,8 @@ import (
|
||||||
"go.woodpecker-ci.org/woodpecker/v2/server/store"
|
"go.woodpecker-ci.org/woodpecker/v2/server/store"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const updateAgentLastWorkDelay = time.Minute
|
||||||
|
|
||||||
type RPC struct {
|
type RPC struct {
|
||||||
queue queue.Queue
|
queue queue.Queue
|
||||||
pubsub *pubsub.Publisher
|
pubsub *pubsub.Publisher
|
||||||
|
@ -511,7 +513,7 @@ func (s *RPC) getHostnameFromContext(ctx context.Context) (string, error) {
|
||||||
|
|
||||||
func (s *RPC) updateAgentLastWork(agent *model.Agent) error {
|
func (s *RPC) updateAgentLastWork(agent *model.Agent) error {
|
||||||
// only update agent.LastWork if not done recently
|
// only update agent.LastWork if not done recently
|
||||||
if time.Unix(agent.LastWork, 0).Add(1 * time.Minute).Before(time.Now()) {
|
if time.Unix(agent.LastWork, 0).Add(updateAgentLastWorkDelay).Before(time.Now()) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue