From 886061fb2f1dc18bda1a73d55c42861d012c446f Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Sat, 17 Aug 2024 10:18:47 +0200 Subject: [PATCH] move arbitrary number into const (#4044) --- server/grpc/rpc.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/grpc/rpc.go b/server/grpc/rpc.go index bdd498b13..012167c23 100644 --- a/server/grpc/rpc.go +++ b/server/grpc/rpc.go @@ -39,6 +39,8 @@ import ( "go.woodpecker-ci.org/woodpecker/v2/server/store" ) +const updateAgentLastWorkDelay = time.Minute + type RPC struct { queue queue.Queue pubsub *pubsub.Publisher @@ -511,7 +513,7 @@ func (s *RPC) getHostnameFromContext(ctx context.Context) (string, error) { func (s *RPC) updateAgentLastWork(agent *model.Agent) error { // 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 }