modificato l'output del log
This commit is contained in:
parent
831b17ca7e
commit
6c3ffa7c7b
4 changed files with 14 additions and 14 deletions
|
@ -108,8 +108,8 @@ func consumer(id int) {
|
||||||
count.AddLog(len(prod.logins))
|
count.AddLog(len(prod.logins))
|
||||||
|
|
||||||
if opts.Debug {
|
if opts.Debug {
|
||||||
fmt.Printf("CONS (%d): user=%s logins=%d in %v - active=%d\n\r", id, prod.user, len(prod.logins), time.Since(start), dbs.rdb.ActiveCount())
|
fmt.Printf("CONS (%d): user=%s logins=%d in %v - active=%d\n", id, prod.user, len(prod.logins), time.Since(start), dbs.rdb.ActiveCount())
|
||||||
// log.Printf("CONS (%d): user=%s logins=%d in %v - active=%d\n\r", id, prod.user, len(prod.logins), time.Since(start), dbs.rdb.ActiveCount())
|
// log.Printf("CONS (%d): user=%s logins=%d in %v - active=%d\n", id, prod.user, len(prod.logins), time.Since(start), dbs.rdb.ActiveCount())
|
||||||
}
|
}
|
||||||
|
|
||||||
remove[id] <- cons
|
remove[id] <- cons
|
||||||
|
|
2
main.go
2
main.go
|
@ -11,7 +11,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
_VERSION = "v2.2.5"
|
_VERSION = "v2.2.6"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
20
producer.go
20
producer.go
|
@ -23,15 +23,15 @@ func producer(id int) {
|
||||||
// estrae un userid dalla lista degli utenti che hanno fatto login
|
// estrae un userid dalla lista degli utenti che hanno fatto login
|
||||||
user, err := redis.String(conn.Do("spop", "llindex"))
|
user, err := redis.String(conn.Do("spop", "llindex"))
|
||||||
// if opts.Debug {
|
// if opts.Debug {
|
||||||
// log.Printf("SPOP: %+v - %+v\n\r", user, err)
|
// log.Printf("SPOP: %+v - %+v\n", user, err)
|
||||||
// fmt.Printf("SPOP: %+v - %+v\n\r", user, err)
|
// fmt.Printf("SPOP: %+v - %+v\n", user, err)
|
||||||
// }
|
// }
|
||||||
// se non ci sono piu' userid esce
|
// se non ci sono piu' userid esce
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if opts.Debug {
|
if opts.Debug {
|
||||||
fmt.Printf("LLINDEX empty: %v\n\r", err)
|
fmt.Printf("LLINDEX empty: %v\n", err)
|
||||||
}
|
}
|
||||||
log.Printf("LLINDEX empty: %v\n\r", err)
|
log.Printf("LLINDEX empty: %v\n", err)
|
||||||
//loop[id] = false
|
//loop[id] = false
|
||||||
//done[id] <- true
|
//done[id] <- true
|
||||||
break
|
break
|
||||||
|
@ -41,18 +41,18 @@ func producer(id int) {
|
||||||
logs, err := redis.Strings(conn.Do("lrange", user, "0", "-1"))
|
logs, err := redis.Strings(conn.Do("lrange", user, "0", "-1"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if opts.Debug {
|
if opts.Debug {
|
||||||
fmt.Printf("LRANGE: %+v - %+v\n\r", err, logs)
|
fmt.Printf("LRANGE: %+v - %+v\n", err, logs)
|
||||||
}
|
}
|
||||||
log.Printf("LRANGE: %+v - %+v\n\r", err, logs)
|
log.Printf("LRANGE: %+v - %+v\n", err, logs)
|
||||||
}
|
}
|
||||||
// if opts.Debug {
|
// if opts.Debug {
|
||||||
// fmt.Printf("LRANGE: %s - %d\n\r", user, len(logs))
|
// fmt.Printf("LRANGE: %s - %d\n", user, len(logs))
|
||||||
// log.Printf("LRANGE: %s - %d\n\r", user, len(logs))
|
// log.Printf("LRANGE: %s - %d\n", user, len(logs))
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if opts.Debug {
|
if opts.Debug {
|
||||||
fmt.Printf("PROD (%d): user=%s login=%d in %v - conn=%d\n\r", id, user, len(logs), time.Since(start), dbs.rdb.ActiveCount())
|
fmt.Printf("PROD (%d): user=%s login=%d in %v - conn=%d\n", id, user, len(logs), time.Since(start), dbs.rdb.ActiveCount())
|
||||||
// log.Printf("PROD (%d): user=%s login=%d in %v - conn=%d\n\r", id, user, len(logs), time.Since(start), dbs.rdb.ActiveCount())
|
// log.Printf("PROD (%d): user=%s login=%d in %v - conn=%d\n", id, user, len(logs), time.Since(start), dbs.rdb.ActiveCount())
|
||||||
}
|
}
|
||||||
|
|
||||||
count.AddUser()
|
count.AddUser()
|
||||||
|
|
|
@ -35,7 +35,7 @@ func remover(id int) {
|
||||||
conn.Flush()
|
conn.Flush()
|
||||||
count.AddRem(len(rem.logins))
|
count.AddRem(len(rem.logins))
|
||||||
if opts.Debug {
|
if opts.Debug {
|
||||||
fmt.Printf("LREM (%d): %s - %d - %+v\n\r", id, rem.user, len(rem.logins), time.Since(start))
|
fmt.Printf("LREM (%d): %s - %d - %+v\n", id, rem.user, len(rem.logins), time.Since(start))
|
||||||
}
|
}
|
||||||
wg.Done()
|
wg.Done()
|
||||||
count.RemWG(id)
|
count.RemWG(id)
|
||||||
|
|
Loading…
Add table
Reference in a new issue