mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-21 07:08:45 +05:00
Added failover test with multiple events in a single file
This commit is contained in:
committed by
Dan Christian Bogos
parent
9285d5ba2e
commit
e0b9dcb35d
@@ -20,14 +20,8 @@ package engine
|
||||
|
||||
import (
|
||||
"net/url"
|
||||
"os"
|
||||
"path"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/cgrates/cgrates/config"
|
||||
"github.com/cgrates/cgrates/guardian"
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -68,20 +62,6 @@ type Poster interface {
|
||||
Close()
|
||||
}
|
||||
|
||||
func writeToFile(fileDir, fileName string, content []byte) (err error) {
|
||||
fallbackFilePath := path.Join(fileDir, fileName)
|
||||
_, err = guardian.Guardian.Guard(func() (interface{}, error) {
|
||||
fileOut, err := os.Create(fallbackFilePath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
_, err = fileOut.Write(content)
|
||||
fileOut.Close()
|
||||
return nil, err
|
||||
}, config.CgrConfig().GeneralCfg().LockingTimeout, utils.FileLockPrefix+fallbackFilePath)
|
||||
return
|
||||
}
|
||||
|
||||
func parseURL(dialURL string) (URL string, qID string, err error) {
|
||||
u, err := url.Parse(dialURL)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user