mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 10:06:24 +05:00
Config changes: httpposter_attempts -> poster_attempts, failed_requests_dir -> failed_posts_dir
This commit is contained in:
@@ -1677,7 +1677,7 @@ type ArgsReplyFailedPosts struct {
|
||||
}
|
||||
|
||||
func (v1 *ApierV1) ReplayFailedPosts(args ArgsReplyFailedPosts, reply *string) (err error) {
|
||||
failedReqsInDir := v1.Config.FailedRequestsDir
|
||||
failedReqsInDir := v1.Config.FailedPostsDir
|
||||
if args.FailedRequestsInDir != nil && *args.FailedRequestsInDir != "" {
|
||||
failedReqsInDir = *args.FailedRequestsInDir
|
||||
}
|
||||
@@ -1722,7 +1722,7 @@ func (v1 *ApierV1) ReplayFailedPosts(args ArgsReplyFailedPosts, reply *string) (
|
||||
}
|
||||
_, err = utils.NewHTTPPoster(v1.Config.HttpSkipTlsVerify,
|
||||
v1.Config.ReplyTimeout).Post(ffn.Address, utils.PosterTransportContentTypes[ffn.Transport], fileContent,
|
||||
v1.Config.HttpPosterAttempts, path.Join(failedReqsOutDir, file.Name()))
|
||||
v1.Config.PosterAttempts, path.Join(failedReqsOutDir, file.Name()))
|
||||
if err != nil { // Got error from HTTPPoster could be that content was not written, we need to write it ourselves
|
||||
fileOutPath := path.Join(failedReqsOutDir, ffn.AsString())
|
||||
_, err := guardian.Guardian.Guard(func() (interface{}, error) {
|
||||
|
||||
@@ -220,8 +220,8 @@ type CGRConfig struct {
|
||||
RoundingDecimals int // Number of decimals to round end prices at
|
||||
HttpSkipTlsVerify bool // If enabled Http Client will accept any TLS certificate
|
||||
TpExportPath string // Path towards export folder for offline Tariff Plans
|
||||
HttpPosterAttempts int
|
||||
FailedRequestsDir string // Directory path where we store failed http requests
|
||||
PosterAttempts int
|
||||
FailedPostsDir string // Directory path where we store failed http requests
|
||||
MaxCallDuration time.Duration // The maximum call duration (used by responder when querying DerivedCharging) // ToDo: export it in configuration file
|
||||
LockingTimeout time.Duration // locking mechanism timeout to avoid deadlocks
|
||||
LogLevel int // system wide log level, nothing higher than this will be logged
|
||||
@@ -754,11 +754,11 @@ func (self *CGRConfig) loadFromJsonCfg(jsnCfg *CgrJsonCfg) error {
|
||||
if jsnGeneralCfg.Tpexport_dir != nil {
|
||||
self.TpExportPath = *jsnGeneralCfg.Tpexport_dir
|
||||
}
|
||||
if jsnGeneralCfg.Httpposter_attempts != nil {
|
||||
self.HttpPosterAttempts = *jsnGeneralCfg.Httpposter_attempts
|
||||
if jsnGeneralCfg.Poster_attempts != nil {
|
||||
self.PosterAttempts = *jsnGeneralCfg.Poster_attempts
|
||||
}
|
||||
if jsnGeneralCfg.Failed_requests_dir != nil {
|
||||
self.FailedRequestsDir = *jsnGeneralCfg.Failed_requests_dir
|
||||
if jsnGeneralCfg.Failed_posts_dir != nil {
|
||||
self.FailedPostsDir = *jsnGeneralCfg.Failed_posts_dir
|
||||
}
|
||||
if jsnGeneralCfg.Default_timezone != nil {
|
||||
self.DefaultTimezone = *jsnGeneralCfg.Default_timezone
|
||||
|
||||
@@ -27,25 +27,25 @@ const CGRATES_CFG_JSON = `
|
||||
// This is what you get when you load CGRateS with an empty configuration file.
|
||||
|
||||
"general": {
|
||||
"instance_id": "", // identifier of this instance in the cluster, if empty it will be autogenerated
|
||||
"log_level": 6, // control the level of messages logged (0-emerg to 7-debug)
|
||||
"http_skip_tls_verify": false, // if enabled Http Client will accept any TLS certificate
|
||||
"rounding_decimals": 5, // system level precision for floats
|
||||
"dbdata_encoding": "msgpack", // encoding used to store object data in strings: <msgpack|json>
|
||||
"tpexport_dir": "/var/spool/cgrates/tpe", // path towards export folder for offline Tariff Plans
|
||||
"httpposter_attempts": 3, // number of http attempts before considering request failed (eg: *call_url)
|
||||
"failed_requests_dir": "/var/spool/cgrates/failed_requests", // directory path where we store failed requests
|
||||
"default_request_type": "*rated", // default request type to consider when missing from requests: <""|*prepaid|*postpaid|*pseudoprepaid|*rated>
|
||||
"default_category": "call", // default category to consider when missing from requests
|
||||
"default_tenant": "cgrates.org", // default tenant to consider when missing from requests
|
||||
"default_timezone": "Local", // default timezone for timestamps where not specified <""|UTC|Local|$IANA_TZ_DB>
|
||||
"connect_attempts": 3, // initial server connect attempts
|
||||
"reconnects": -1, // number of retries in case of connection lost
|
||||
"connect_timeout": "1s", // consider connection unsuccessful on timeout, 0 to disable the feature
|
||||
"reply_timeout": "2s", // consider connection down for replies taking longer than this value
|
||||
"response_cache_ttl": "0s", // the life span of a cached response
|
||||
"internal_ttl": "2m", // maximum duration to wait for internal connections before giving up
|
||||
"locking_timeout": "5s", // timeout internal locks to avoid deadlocks
|
||||
"instance_id": "", // identifier of this instance in the cluster, if empty it will be autogenerated
|
||||
"log_level": 6, // control the level of messages logged (0-emerg to 7-debug)
|
||||
"http_skip_tls_verify": false, // if enabled Http Client will accept any TLS certificate
|
||||
"rounding_decimals": 5, // system level precision for floats
|
||||
"dbdata_encoding": "msgpack", // encoding used to store object data in strings: <msgpack|json>
|
||||
"tpexport_dir": "/var/spool/cgrates/tpe", // path towards export folder for offline Tariff Plans
|
||||
"poster_attempts": 3, // number of attempts before considering post request failed (eg: *call_url, CDR replication)
|
||||
"failed_posts_dir": "/var/spool/cgrates/failed_posts", // directory path where we store failed requests
|
||||
"default_request_type": "*rated", // default request type to consider when missing from requests: <""|*prepaid|*postpaid|*pseudoprepaid|*rated>
|
||||
"default_category": "call", // default category to consider when missing from requests
|
||||
"default_tenant": "cgrates.org", // default tenant to consider when missing from requests
|
||||
"default_timezone": "Local", // default timezone for timestamps where not specified <""|UTC|Local|$IANA_TZ_DB>
|
||||
"connect_attempts": 3, // initial server connect attempts
|
||||
"reconnects": -1, // number of retries in case of connection lost
|
||||
"connect_timeout": "1s", // consider connection unsuccessful on timeout, 0 to disable the feature
|
||||
"reply_timeout": "2s", // consider connection down for replies taking longer than this value
|
||||
"response_cache_ttl": "0s", // the life span of a cached response
|
||||
"internal_ttl": "2m", // maximum duration to wait for internal connections before giving up
|
||||
"locking_timeout": "5s", // timeout internal locks to avoid deadlocks
|
||||
},
|
||||
|
||||
|
||||
|
||||
@@ -44,8 +44,8 @@ func TestDfGeneralJsonCfg(t *testing.T) {
|
||||
Rounding_decimals: utils.IntPointer(5),
|
||||
Dbdata_encoding: utils.StringPointer("msgpack"),
|
||||
Tpexport_dir: utils.StringPointer("/var/spool/cgrates/tpe"),
|
||||
Httpposter_attempts: utils.IntPointer(3),
|
||||
Failed_requests_dir: utils.StringPointer("/var/spool/cgrates/failed_requests"),
|
||||
Poster_attempts: utils.IntPointer(3),
|
||||
Failed_posts_dir: utils.StringPointer("/var/spool/cgrates/failed_posts"),
|
||||
Default_request_type: utils.StringPointer(utils.META_RATED),
|
||||
Default_category: utils.StringPointer("call"),
|
||||
Default_tenant: utils.StringPointer("cgrates.org"),
|
||||
|
||||
@@ -151,11 +151,11 @@ func TestCgrCfgJSONDefaultsGeneral(t *testing.T) {
|
||||
if cgrCfg.TpExportPath != "/var/spool/cgrates/tpe" {
|
||||
t.Error(cgrCfg.TpExportPath)
|
||||
}
|
||||
if cgrCfg.HttpPosterAttempts != 3 {
|
||||
t.Error(cgrCfg.HttpPosterAttempts)
|
||||
if cgrCfg.PosterAttempts != 3 {
|
||||
t.Error(cgrCfg.PosterAttempts)
|
||||
}
|
||||
if cgrCfg.FailedRequestsDir != "/var/spool/cgrates/failed_requests" {
|
||||
t.Error(cgrCfg.FailedRequestsDir)
|
||||
if cgrCfg.FailedPostsDir != "/var/spool/cgrates/failed_posts" {
|
||||
t.Error(cgrCfg.FailedPostsDir)
|
||||
}
|
||||
if cgrCfg.DefaultReqType != "*rated" {
|
||||
t.Error(cgrCfg.DefaultReqType)
|
||||
|
||||
@@ -25,8 +25,8 @@ type GeneralJsonCfg struct {
|
||||
Rounding_decimals *int
|
||||
Dbdata_encoding *string
|
||||
Tpexport_dir *string
|
||||
Httpposter_attempts *int
|
||||
Failed_requests_dir *string
|
||||
Poster_attempts *int
|
||||
Failed_posts_dir *string
|
||||
Default_request_type *string
|
||||
Default_category *string
|
||||
Default_tenant *string
|
||||
|
||||
@@ -7,25 +7,25 @@
|
||||
// This is what you get when you load CGRateS with an empty configuration file.
|
||||
|
||||
// "general": {
|
||||
// "instance_id": "", // identifier of this instance in the cluster, if empty it will be autogenerated
|
||||
// "log_level": 6, // control the level of messages logged (0-emerg to 7-debug)
|
||||
// "http_skip_tls_verify": false, // if enabled Http Client will accept any TLS certificate
|
||||
// "rounding_decimals": 5, // system level precision for floats
|
||||
// "dbdata_encoding": "msgpack", // encoding used to store object data in strings: <msgpack|json>
|
||||
// "tpexport_dir": "/var/spool/cgrates/tpe", // path towards export folder for offline Tariff Plans
|
||||
// "httpposter_attempts": 3, // number of http attempts before considering request failed (eg: *call_url)
|
||||
// "failed_requests_dir": "/var/spool/cgrates/failed_requests", // directory path where we store failed requests
|
||||
// "default_request_type": "*rated", // default request type to consider when missing from requests: <""|*prepaid|*postpaid|*pseudoprepaid|*rated>
|
||||
// "default_category": "call", // default category to consider when missing from requests
|
||||
// "default_tenant": "cgrates.org", // default tenant to consider when missing from requests
|
||||
// "default_timezone": "Local", // default timezone for timestamps where not specified <""|UTC|Local|$IANA_TZ_DB>
|
||||
// "connect_attempts": 3, // initial server connect attempts
|
||||
// "reconnects": -1, // number of retries in case of connection lost
|
||||
// "connect_timeout": "1s", // consider connection unsuccessful on timeout, 0 to disable the feature
|
||||
// "reply_timeout": "2s", // consider connection down for replies taking longer than this value
|
||||
// "response_cache_ttl": "0s", // the life span of a cached response
|
||||
// "internal_ttl": "2m", // maximum duration to wait for internal connections before giving up
|
||||
// "locking_timeout": "5s", // timeout internal locks to avoid deadlocks
|
||||
// "instance_id": "", // identifier of this instance in the cluster, if empty it will be autogenerated
|
||||
// "log_level": 6, // control the level of messages logged (0-emerg to 7-debug)
|
||||
// "http_skip_tls_verify": false, // if enabled Http Client will accept any TLS certificate
|
||||
// "rounding_decimals": 5, // system level precision for floats
|
||||
// "dbdata_encoding": "msgpack", // encoding used to store object data in strings: <msgpack|json>
|
||||
// "tpexport_dir": "/var/spool/cgrates/tpe", // path towards export folder for offline Tariff Plans
|
||||
// "poster_attempts": 3, // number of attempts before considering post request failed (eg: *call_url, CDR replication)
|
||||
// "failed_posts_dir": "/var/spool/cgrates/failed_posts", // directory path where we store failed requests
|
||||
// "default_request_type": "*rated", // default request type to consider when missing from requests: <""|*prepaid|*postpaid|*pseudoprepaid|*rated>
|
||||
// "default_category": "call", // default category to consider when missing from requests
|
||||
// "default_tenant": "cgrates.org", // default tenant to consider when missing from requests
|
||||
// "default_timezone": "Local", // default timezone for timestamps where not specified <""|UTC|Local|$IANA_TZ_DB>
|
||||
// "connect_attempts": 3, // initial server connect attempts
|
||||
// "reconnects": -1, // number of retries in case of connection lost
|
||||
// "connect_timeout": "1s", // consider connection unsuccessful on timeout, 0 to disable the feature
|
||||
// "reply_timeout": "2s", // consider connection down for replies taking longer than this value
|
||||
// "response_cache_ttl": "0s", // the life span of a cached response
|
||||
// "internal_ttl": "2m", // maximum duration to wait for internal connections before giving up
|
||||
// "locking_timeout": "5s", // timeout internal locks to avoid deadlocks
|
||||
// },
|
||||
|
||||
|
||||
|
||||
@@ -418,7 +418,7 @@ func callUrl(ub *Account, sq *StatsQueueTriggered, a *Action, acs Actions) error
|
||||
RequestID: utils.GenUUID(), FileSuffix: utils.JSNSuffix}
|
||||
_, err = utils.NewHTTPPoster(config.CgrConfig().HttpSkipTlsVerify,
|
||||
config.CgrConfig().ReplyTimeout).Post(a.ExtraParameters, utils.CONTENT_JSON, jsn,
|
||||
config.CgrConfig().HttpPosterAttempts, path.Join(cfg.FailedRequestsDir, ffn.AsString()))
|
||||
config.CgrConfig().PosterAttempts, path.Join(cfg.FailedPostsDir, ffn.AsString()))
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -441,7 +441,7 @@ func callUrlAsync(ub *Account, sq *StatsQueueTriggered, a *Action, acs Actions)
|
||||
RequestID: utils.GenUUID(), FileSuffix: utils.JSNSuffix}
|
||||
go utils.NewHTTPPoster(config.CgrConfig().HttpSkipTlsVerify,
|
||||
config.CgrConfig().ReplyTimeout).Post(a.ExtraParameters, utils.CONTENT_JSON, jsn,
|
||||
config.CgrConfig().HttpPosterAttempts, path.Join(cfg.FailedRequestsDir, ffn.AsString()))
|
||||
config.CgrConfig().PosterAttempts, path.Join(cfg.FailedPostsDir, ffn.AsString()))
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -499,7 +499,7 @@ func (self *CdrServer) replicateCdr(cdr *CDR) error {
|
||||
}
|
||||
go func(body interface{}, rplCfg *config.CDRReplicationCfg, content string, errChan chan error) {
|
||||
fallbackPath := path.Join(
|
||||
self.cgrCfg.FailedRequestsDir,
|
||||
self.cgrCfg.FailedPostsDir,
|
||||
rplCfg.FallbackFileName())
|
||||
if _, err := self.httpPoster.Post(rplCfg.Address, utils.PosterTransportContentTypes[rplCfg.Transport], body, rplCfg.Attempts, fallbackPath); err != nil {
|
||||
utils.Logger.Err(fmt.Sprintf(
|
||||
|
||||
@@ -146,16 +146,16 @@ func TestCdrsFileFailover(t *testing.T) {
|
||||
break
|
||||
}
|
||||
}
|
||||
filesInDir, _ := ioutil.ReadDir(cdrsMasterCfg.FailedRequestsDir)
|
||||
filesInDir, _ := ioutil.ReadDir(cdrsMasterCfg.FailedPostsDir)
|
||||
if len(filesInDir) == 0 {
|
||||
t.Fatalf("No files in directory: %s", cdrsMasterCfg.FailedRequestsDir)
|
||||
t.Fatalf("No files in directory: %s", cdrsMasterCfg.FailedPostsDir)
|
||||
}
|
||||
var fileName string
|
||||
for _, file := range filesInDir { // First file in directory is the one we need, harder to find it's name out of config
|
||||
fileName = file.Name()
|
||||
break
|
||||
}
|
||||
filePath := path.Join(cdrsMasterCfg.FailedRequestsDir, fileName)
|
||||
filePath := path.Join(cdrsMasterCfg.FailedPostsDir, fileName)
|
||||
if readBytes, err := ioutil.ReadFile(filePath); err != nil {
|
||||
t.Error(err)
|
||||
} else if !reflect.DeepEqual(failoverContent, readBytes) { // Checking just the prefix should do since some content is dynamic
|
||||
|
||||
@@ -38,7 +38,7 @@ binary-arch: clean
|
||||
mkdir -p $(PKGDIR)/var/spool/cgrates/cdre/csv
|
||||
mkdir -p $(PKGDIR)/var/spool/cgrates/cdre/fwv
|
||||
mkdir -p $(PKGDIR)/var/spool/cgrates/tpe
|
||||
mkdir -p $(PKGDIR)/var/spool/cgrates/failed_requests
|
||||
mkdir -p $(PKGDIR)/var/spool/cgrates/failed_posts
|
||||
mkdir -p $(PKGDIR)/var/lib/cgrates/history
|
||||
mkdir -p $(PKGDIR)/var/lib/cgrates/cache_dump
|
||||
dh_strip
|
||||
|
||||
@@ -93,7 +93,7 @@ mkdir -p $RPM_BUILD_ROOT%{_spooldir}/cdrc/out
|
||||
mkdir -p $RPM_BUILD_ROOT%{_spooldir}/cdre/csv
|
||||
mkdir -p $RPM_BUILD_ROOT%{_spooldir}/cdre/fwv
|
||||
mkdir -p $RPM_BUILD_ROOT%{_spooldir}/tpe
|
||||
mkdir -p $RPM_BUILD_ROOT%{_spooldir}/failed_requests
|
||||
mkdir -p $RPM_BUILD_ROOT%{_spooldir}/failed_posts_
|
||||
mkdir -p $RPM_BUILD_ROOT%{_libdir}/history
|
||||
mkdir -p $RPM_BUILD_ROOT%{_libdir}/cache_dump
|
||||
install -D -m 0644 -p src/github.com/cgrates/cgrates/packages/redhat_fedora/%{name}.options $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/%{name}
|
||||
|
||||
@@ -37,7 +37,7 @@ binary-arch: clean
|
||||
mkdir -p $(PKGDIR)/var/spool/cgrates/cdre/csv
|
||||
mkdir -p $(PKGDIR)/var/spool/cgrates/cdre/fwv
|
||||
mkdir -p $(PKGDIR)/var/spool/cgrates/tpe
|
||||
mkdir -p $(PKGDIR)/var/spool/cgrates/failed_requests
|
||||
mkdir -p $(PKGDIR)/var/spool/cgrates/failed_posts
|
||||
mkdir -p $(PKGDIR)/var/lib/cgrates/history
|
||||
mkdir -p $(PKGDIR)/var/lib/cgrates/cache_dump
|
||||
dh_strip
|
||||
|
||||
Reference in New Issue
Block a user