Skip to content

Commit 01bc98a

Browse files
committed
Fix failure count check
1 parent 844c7d3 commit 01bc98a

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

internal/server/app_updates.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ func (s *Server) ReloadApps(ctx context.Context, appPathGlob string, approve, dr
177177
}
178178

179179
func (s *Server) loadAppCode(ctx context.Context, tx types.Transaction, appEntry *types.AppEntry, branch, commit, gitAuth string, repoCache *RepoCache, forceReload bool) (bool, error) {
180-
s.Info().Msgf("Reloading app code %v", appEntry)
180+
s.Debug().Msgf("Reloading app code %v", appEntry)
181181

182182
if isGit(appEntry.SourceUrl) {
183183
currentSha := appEntry.Metadata.VersionMetadata.GitCommit
@@ -194,7 +194,7 @@ func (s *Server) loadAppCode(ctx context.Context, tx types.Transaction, appEntry
194194
}
195195
if !forceReload && currentSha != "" && newSha == currentSha && (commit == "" || commit == currentSha) {
196196
// If no commit is specified, and the current version is the same as the latest commit, skip reload
197-
s.Info().Msgf("App %s already at latest commit %s, skipping reload", appEntry.AppPathDomain(), newSha)
197+
s.Debug().Msgf("App %s already at latest commit %s, skipping reload", appEntry.AppPathDomain(), newSha)
198198
return false, nil
199199
}
200200

internal/server/sync.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package server
66
import (
77
"context"
88
"encoding/base64"
9+
"errors"
910
"fmt"
1011
"strings"
1112
"time"
@@ -57,6 +58,10 @@ func (s *Server) CreateSyncEntry(ctx context.Context, path string, scheduled, dr
5758
if err != nil {
5859
return nil, err
5960
}
61+
if syncStatus.Error != "" {
62+
// The sync job job failed, delete the entry
63+
return nil, errors.New(syncStatus.Error)
64+
}
6065

6166
ret := types.SyncCreateResponse{
6267
Id: syncEntry.Id,
@@ -225,7 +230,7 @@ func (s *Server) runSyncJob(ctx context.Context, inputTx types.Transaction, entr
225230
status.Error = applyErr.Error()
226231
applyInfo = &types.AppApplyResponse{}
227232
applyInfo.FilteredApps = lastRunApps
228-
status.FailureCount++
233+
status.FailureCount = entry.Status.FailureCount + 1
229234
} else {
230235
status.CommitId = applyInfo.CommitId
231236
status.FailureCount = 0

0 commit comments

Comments
 (0)