Compress a bit GetFileName of CdrReplicationCfg

This commit is contained in:
DanB
2015-10-13 12:43:33 +02:00
parent af1d8e3cc5
commit 831e633281
2 changed files with 4 additions and 10 deletions

View File

@@ -33,13 +33,8 @@ type CdrReplicationCfg struct {
CdrFilter utils.RSRFields // Only replicate if the filters here are matching
}
func (rplCfg CdrReplicationCfg) GetFallbackFileName() string {
serverName := url.QueryEscape(rplCfg.Server)
result := fmt.Sprintf("cdr_%s_%s_%s.form",
rplCfg.Transport,
serverName, utils.GenUUID())
return result
func (rplCfg CdrReplicationCfg) FallbackFileName() string {
return fmt.Sprintf("cdr_%s_%s_%s.form", rplCfg.Transport, url.QueryEscape(rplCfg.Server), utils.GenUUID())
}
type SureTaxCfg struct {

View File

@@ -379,11 +379,9 @@ func (self *CdrServer) replicateCdr(cdr *StoredCdr) error {
errChan := make(chan error)
go func(body interface{}, rplCfg *config.CdrReplicationCfg, content string, errChan chan error) {
fallbackPath := path.Join(
self.cgrCfg.HttpFailedDir,
rplCfg.GetFallbackFileName())
rplCfg.FallbackFileName())
_, err := utils.HttpPoster(
rplCfg.Server, self.cgrCfg.HttpSkipTlsVerify, body,
content, rplCfg.Attempts, fallbackPath)
@@ -398,6 +396,7 @@ func (self *CdrServer) replicateCdr(cdr *StoredCdr) error {
if rplCfg.Synchronous { // Synchronize here
<-errChan
}
}
return nil
}