mirror of
https://github.com/goharbor/harbor.git
synced 2024-09-30 14:27:35 +02:00
Skip to refresh execution status when unchanged (#17023)
fixes #16640 Signed-off-by: stonezdj <stonezdj@gmail.com>
This commit is contained in:
parent
6c02854921
commit
88b8a7ac2c
@ -1,16 +1,16 @@
|
|||||||
// Copyright Project Harbor Authors
|
// Copyright Project Harbor Authors
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
// you may not use this file except in compliance with the License.
|
// you may not use this file except in compliance with the License.
|
||||||
// You may obtain a copy of the License at
|
// You may obtain a copy of the License at
|
||||||
//
|
//
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
//
|
//
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
package dao
|
package dao
|
||||||
|
|
||||||
@ -205,10 +205,6 @@ func (e *executionDAO) RefreshStatus(ctx context.Context, id int64) (bool, strin
|
|||||||
// 3. bool: whether a retry is needed
|
// 3. bool: whether a retry is needed
|
||||||
// 4. error: the error
|
// 4. error: the error
|
||||||
func (e *executionDAO) refreshStatus(ctx context.Context, id int64) (bool, string, bool, error) {
|
func (e *executionDAO) refreshStatus(ctx context.Context, id int64) (bool, string, bool, error) {
|
||||||
execution, err := e.Get(ctx, id)
|
|
||||||
if err != nil {
|
|
||||||
return false, "", false, err
|
|
||||||
}
|
|
||||||
metrics, err := e.GetMetrics(ctx, id)
|
metrics, err := e.GetMetrics(ctx, id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, "", false, err
|
return false, "", false, err
|
||||||
@ -229,6 +225,14 @@ func (e *executionDAO) refreshStatus(ctx context.Context, id int64) (bool, strin
|
|||||||
status = job.SuccessStatus.String()
|
status = job.SuccessStatus.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
execution, err := e.Get(ctx, id)
|
||||||
|
if err != nil {
|
||||||
|
return false, "", false, err
|
||||||
|
}
|
||||||
|
if status == execution.Status {
|
||||||
|
return false, status, false, nil // status not changed
|
||||||
|
}
|
||||||
|
|
||||||
ormer, err := orm.FromContext(ctx)
|
ormer, err := orm.FromContext(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, "", false, err
|
return false, "", false, err
|
||||||
|
Loading…
Reference in New Issue
Block a user