Concurrent requests configured also via shared variable

This commit is contained in:
DanB
2020-10-31 20:41:33 +01:00
parent c22170b407
commit 9d34293603
3 changed files with 12 additions and 2 deletions

View File

@@ -450,7 +450,15 @@ func main() {
}
utils.Logger.SetLogLevel(lgLevel)
// init the concurrentRequests
utils.ConReqs = utils.NewConReqs(cfg.GeneralCfg().ConcurrentRequests, cfg.GeneralCfg().ConcurrentStrategy)
cncReqsLimit := cfg.GeneralCfg().ConcurrentRequests
if utils.ConcurrentReqsLimit != 0 { // used as shared variable
cncReqsLimit = utils.ConcurrentReqsLimit
}
cncReqsStrategy := cfg.GeneralCfg().ConcurrentStrategy
if utils.ConcurrentReqsStrategy != "" {
cncReqsStrategy = utils.ConcurrentReqsStrategy
}
utils.ConReqs = utils.NewConReqs(cncReqsLimit, cncReqsStrategy)
utils.Logger.Info(fmt.Sprintf("<CoreS> starting version <%s><%s>", vers, goVers))
cfg.LazySanityCheck()

View File

@@ -46,7 +46,7 @@ func NewConReqs(reqs int, strategy string) *ConcReqs {
// IsLimited returns true if the limit is not 0
func (cR *ConcReqs) IsLimited() bool {
return ConReqs.limit != 0
return cR.limit != 0
}
// Allocate will reserve a channel for the API call

View File

@@ -871,6 +871,8 @@ const (
ProcessRuns = "ProcessRuns"
HashtagSep = "#"
MetaRounding = "*rounding"
ConcurrentReqsLimit = 0
ConcurrentReqsStrategy = ""
)
// Migrator Action