diff --git a/cmd/cgr-rater/scheduler.go b/cmd/cgr-rater/scheduler.go
index afadca763..78cb0142c 100644
--- a/cmd/cgr-rater/scheduler.go
+++ b/cmd/cgr-rater/scheduler.go
@@ -19,6 +19,7 @@ along with this program. If not, see
package main
import (
+ "fmt"
"github.com/cgrates/cgrates/timespans"
"log"
"sort"
@@ -68,7 +69,7 @@ func (s scheduler) loop() {
func loadActionTimings(storage timespans.StorageGetter) {
actionTimings, err := storage.GetAllActionTimings()
if err != nil {
- log.Fatalf("Cannot get action timings:", err)
+ timespans.Logger.Warning(fmt.Sprintf("Cannot get action timings: %v", err))
}
// recreate the queue
s.queue = timespans.ActionTimingPriotityList{}
diff --git a/cmd/stress/cgr-balancerstress/cgr-balancerstress.go b/cmd/stress/cgr-balancerstress/cgr-balancerstress.go
deleted file mode 100644
index 3ed049bef..000000000
--- a/cmd/stress/cgr-balancerstress/cgr-balancerstress.go
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
-Rating system designed to be used in VoIP Carriers World
-Copyright (C) 2012 Radu Ioan Fericean
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see
-*/
-
-package main
-
-import (
- "flag"
- "github.com/cgrates/cgrates/timespans"
- "log"
- "net/rpc"
- //"net/rpc/jsonrpc"
- "time"
-)
-
-var (
- balancer = flag.String("balancer", "localhost:2001", "balancer server address")
- runs = flag.Int("runs", 10000, "stress cycle number")
- parallel = flag.Bool("parallel", false, "run requests in parallel")
-)
-
-func main() {
- flag.Parse()
- t1 := time.Date(2012, time.February, 02, 17, 30, 0, 0, time.UTC)
- t2 := time.Date(2012, time.February, 02, 18, 30, 0, 0, time.UTC)
- cd := timespans.CallDescriptor{Direction: "OUT", TOR: "0", Tenant: "vdf", Subject: "rif", Destination: "0256", TimeStart: t1, TimeEnd: t2}
- result := timespans.CallCost{}
- client, err := rpc.Dial("tcp", *balancer)
- if err != nil {
- log.Fatalf("could not connect to balancer: %v", err)
- }
- start := time.Now()
- if *parallel {
- var divCall *rpc.Call
- for i := 0; i < *runs; i++ {
- divCall = client.Go("Responder.GetCost", cd, &result, nil)
- }
- <-divCall.Done
- } else {
- for j := 0; j < *runs; j++ {
- client.Call("Responder.GetCost", cd, &result)
- }
- }
- duration := time.Since(start)
- log.Println(result)
- client.Close()
- log.Printf("Elapsed: %v resulted: %v req/s.", duration, float64(*runs)/duration.Seconds())
-}
diff --git a/cmd/stress/cgr-raterstress/cgr-raterstress.go b/cmd/stress/cgr-raterstress/cgr-raterstress.go
index 880365ee1..340475790 100644
--- a/cmd/stress/cgr-raterstress/cgr-raterstress.go
+++ b/cmd/stress/cgr-raterstress/cgr-raterstress.go
@@ -19,17 +19,19 @@ along with this program. If not, see
package main
import (
+ "flag"
"github.com/cgrates/cgrates/timespans"
"log"
"net/rpc"
- "net/rpc/jsonrpc"
+ //"net/rpc/jsonrpc"
"time"
- "flag"
)
var (
- runs = flag.Int("runs", 10000, "stress cycle number")
- json = flag.Bool("json", false, "use JSON for RPC encoding")
+ balancer = flag.String("balancer", "localhost:2001", "balancer server address")
+ runs = flag.Int("runs", 10000, "stress cycle number")
+ parallel = flag.Bool("parallel", false, "run requests in parallel")
+ json = flag.Bool("json", false, "use JSON for RPC encoding")
)
func main() {
@@ -48,14 +50,20 @@ func main() {
if err != nil {
log.Panic("Could not connect to rater: ", err)
}
- i := 0
start := time.Now()
- for j := 0; j < *runs; j++ {
- client.Call("Responder.GetCost", cd, &result)
+ if *parallel {
+ var divCall *rpc.Call
+ for i := 0; i < *runs; i++ {
+ divCall = client.Go("Responder.GetCost", cd, &result, nil)
+ }
+ <-divCall.Done
+ } else {
+ for j := 0; j < *runs; j++ {
+ client.Call("Responder.GetCost", cd, &result)
+ }
}
duration := time.Since(start)
log.Println(result)
- log.Println(i)
- log.Printf("Elapsed: %v resulted: %v req/s.", duration, float64(*runs)/duration.Seconds())
client.Close()
+ log.Printf("Elapsed: %v resulted: %v req/s.", duration, float64(*runs)/duration.Seconds())
}
diff --git a/cmd/stress/cgr-balancerstress/cgr-balancerstress.py b/cmd/stress/cgr-raterstress/cgr-raterstress.py
similarity index 100%
rename from cmd/stress/cgr-balancerstress/cgr-balancerstress.py
rename to cmd/stress/cgr-raterstress/cgr-raterstress.py