Skip to content

Commit

Permalink
Merge pull request #249 from cdnjs/sven/limit
Browse files Browse the repository at this point in the history
git-sync: limit number of updates per run
  • Loading branch information
xtuc authored Jan 16, 2022
2 parents 0fc0b5b + 5517778 commit b8beebd
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cmd/git-sync/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ func updateLastSync(path string, t time.Time) error {
}

var (
DEBUG = os.Getenv("DEBUG") == "1"
DEBUG = os.Getenv("DEBUG") == "1"
MAX_UPDATES_PER_RUN = 50
)

func main() {
Expand Down Expand Up @@ -103,6 +104,11 @@ func main() {
}
}

if len(newVersions) > MAX_UPDATES_PER_RUN {
newVersions = newVersions[:MAX_UPDATES_PER_RUN]
log.Printf("too many updates; limiting to %d updates\n", MAX_UPDATES_PER_RUN)
}

// Keep track of the last successful version we addedd
lastSuccessfullSync := lastSync

Expand Down

0 comments on commit b8beebd

Please sign in to comment.