Commit cff20dcc authored by Stefan Dähling's avatar Stefan Dähling
Browse files

update state every 25 ms

parent 555479ab
Pipeline #344701 passed with stages
in 1 minute and 37 seconds
......@@ -210,7 +210,7 @@ func pingPongft(ag *agency.Agent, config CustomAgentData) (err error) {
time.Sleep(time.Second * 40)
if config.Start {
state := 0
count := 0
tStateUpdate := time.Now()
var rtts []int
var msg schemas.ACLMessage
msg, err = ag.ACL.NewMessage(config.PeerID, schemas.FIPAProtQuery, schemas.FIPAPerfInform,
......@@ -226,14 +226,13 @@ func pingPongft(ag *agency.Agent, config CustomAgentData) (err error) {
if err != nil {
fmt.Println(err)
}
count++
if count == 10 {
if time.Since(tStateUpdate) > time.Millisecond*25 {
state++
err = ag.Logger.UpdateState(strconv.Itoa(state))
if err != nil {
fmt.Println(err)
}
count = 0
tStateUpdate = time.Now()
}
msg, err = ag.ACL.RecvMessageWait()
if err != nil {
......@@ -249,14 +248,13 @@ func pingPongft(ag *agency.Agent, config CustomAgentData) (err error) {
if err != nil {
fmt.Println(err)
}
count++
if count == 10 {
if time.Since(tStateUpdate) > time.Millisecond*25 {
state++
err = ag.Logger.UpdateState(strconv.Itoa(state))
if err != nil {
fmt.Println(err)
}
count = 0
tStateUpdate = time.Now()
}
msg, err = ag.ACL.RecvMessageWait()
rtt := time.Since(t).Nanoseconds()
......@@ -295,14 +293,13 @@ func pingPongft(ag *agency.Agent, config CustomAgentData) (err error) {
if err != nil {
fmt.Println(err)
}
count++
if count == 10 {
if time.Since(tStateUpdate) > time.Millisecond*25 {
state++
err = ag.Logger.UpdateState(strconv.Itoa(state))
if err != nil {
fmt.Println(err)
}
count = 0
tStateUpdate = time.Now()
}
msg, err = ag.ACL.RecvMessageWait()
if err != nil {
......
......@@ -101,7 +101,7 @@ func (logger *Logger) init() (err error) {
logger.stor = newLocalStorage()
case "production":
logger.logInfo.Println("Cassandra storage")
logger.stor, err = newCassandraStorage([]string{"cassandra", "cass-ssset-1.cassandra", "cass-ssset-2.cassandra"}, "cassandra", "cassandra")
logger.stor, err = newCassandraStorage([]string{"cass-ssset-0.cassandra", "cass-ssset-1.cassandra", "cass-ssset-2.cassandra"}, "cassandra", "cassandra")
default:
err = errors.New("Wrong deployment type: " + deplType)
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment