mirror of
https://github.com/go-gitea/gitea.git
synced 2026-02-22 13:15:23 +01:00
Merge 72e49f3d4249a651c0bd9320f5ae6182f03e2c34 into 86d102494b60a5988c174fc2932466bb164c4128
This commit is contained in:
commit
2d759ec59d
@ -263,7 +263,7 @@ func (opts FindRunnerOptions) ToOrders() string {
|
||||
// GetRunnerByUUID returns a runner via uuid
|
||||
func GetRunnerByUUID(ctx context.Context, uuid string) (*ActionRunner, error) {
|
||||
var runner ActionRunner
|
||||
has, err := db.GetEngine(ctx).Where("uuid=?", uuid).Get(&runner)
|
||||
has, err := db.GetEngine(ctx).Where("uuid=?", uuid).Unscoped().Get(&runner)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
} else if !has {
|
||||
|
||||
@ -46,11 +46,19 @@ var withRunner = connect.WithInterceptors(connect.UnaryInterceptorFunc(func(unar
|
||||
}
|
||||
|
||||
cols := []string{"last_online"}
|
||||
runner.LastOnline = timeutil.TimeStampNow()
|
||||
|
||||
if methodName == "UpdateTask" || methodName == "UpdateLog" {
|
||||
if runner.Deleted > 0 && timeutil.TimeStampNow()-runner.Deleted > timeutil.TimeStamp(10) {
|
||||
return nil, status.Error(codes.Internal, "Runner is deleted")
|
||||
}
|
||||
runner.LastActive = timeutil.TimeStampNow()
|
||||
cols = append(cols, "last_active")
|
||||
} else if runner.Deleted != 0 {
|
||||
return nil, status.Error(codes.Internal, "Runner is deleted")
|
||||
}
|
||||
|
||||
runner.LastOnline = timeutil.TimeStampNow()
|
||||
|
||||
if err := actions_model.UpdateRunner(ctx, runner, cols...); err != nil {
|
||||
log.Error("can't update runner status: %v", err)
|
||||
}
|
||||
|
||||
@ -289,7 +289,7 @@ func (s *Service) UpdateLog(
|
||||
}
|
||||
}
|
||||
|
||||
if err := actions_model.UpdateTask(ctx, task, "log_indexes", "log_length", "log_size", "log_in_storage"); err != nil {
|
||||
if err := actions_model.UpdateTask(ctx, task, "status", "log_indexes", "log_length", "log_size", "log_in_storage"); err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "update task: %v", err)
|
||||
}
|
||||
if remove != nil {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user