ok
This commit is contained in:
parent
a84acd14ca
commit
15c0b5b157
4 changed files with 15 additions and 9 deletions
|
@ -76,7 +76,7 @@ func consumer(id int) {
|
||||||
}
|
}
|
||||||
// inserisce il login su Mongodb
|
// inserisce il login su Mongodb
|
||||||
|
|
||||||
_, err = dbs.ll.Upsert(ind, ml)
|
retval, err := dbs.ll.Upsert(ind, ml)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Insert error: %+v\n", err)
|
log.Printf("Insert error: %+v\n", err)
|
||||||
// se l'errore non e' "duplicate key error" salta al prossimo senza cancellare niente
|
// se l'errore non e' "duplicate key error" salta al prossimo senza cancellare niente
|
||||||
|
@ -85,7 +85,11 @@ func consumer(id int) {
|
||||||
//return
|
//return
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
count.AddDuplicate()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.Printf("%+v - %+v\n", ml, retval)
|
||||||
|
|
||||||
if i < (len(prod.logins) - 1) {
|
if i < (len(prod.logins) - 1) {
|
||||||
cons.logins = append(cons.logins, login)
|
cons.logins = append(cons.logins, login)
|
||||||
// cancella da Redis la riga di login inserita
|
// cancella da Redis la riga di login inserita
|
||||||
|
@ -101,7 +105,7 @@ func consumer(id int) {
|
||||||
|
|
||||||
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\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\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\r", id, prod.user, len(prod.logins), time.Since(start), dbs.rdb.ActiveCount())
|
||||||
}
|
}
|
||||||
|
|
||||||
remove[id] <- cons
|
remove[id] <- cons
|
||||||
|
|
4
main.go
4
main.go
|
@ -93,6 +93,6 @@ func main() {
|
||||||
}
|
}
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
|
|
||||||
fmt.Printf("Stop %v - user: %d - login: %d - errors: %d - rem: %d - conn: %d\n\r", time.Since(start), count.ValUser(), count.ValLog(), count.ValErr(), count.ValRem(), dbs.rdb.ActiveCount())
|
fmt.Printf("Stop %v - user: %d - login: %d - errors: %d - rem: %d - duplicate: %d\n\r", time.Since(start), count.ValUser(), count.ValLog(), count.ValErr(), count.ValRem(), count.ValDup())
|
||||||
log.Printf("Stop %v - user: %d - login: %d - errors: %d - rem: %d - conn: %d\n\r", time.Since(start), count.ValUser(), count.ValLog(), count.ValErr(), count.ValRem(), dbs.rdb.ActiveCount())
|
log.Printf("Stop %v - user: %d - login: %d - errors: %d - rem: %d - duplicate: %d\n\r", time.Since(start), count.ValUser(), count.ValLog(), count.ValErr(), count.ValRem(), count.ValDup())
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,9 +29,9 @@ func producer(id int) {
|
||||||
// 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 {
|
||||||
log.Printf("LLINDEX empty: %v\n\r", err)
|
|
||||||
fmt.Printf("LLINDEX empty: %v\n\r", err)
|
fmt.Printf("LLINDEX empty: %v\n\r", err)
|
||||||
}
|
}
|
||||||
|
log.Printf("LLINDEX empty: %v\n\r", err)
|
||||||
//loop[id] = false
|
//loop[id] = false
|
||||||
done[id] <- true
|
done[id] <- true
|
||||||
break
|
break
|
||||||
|
@ -40,7 +40,9 @@ func producer(id int) {
|
||||||
// estrae tutti i login dell'utente "user"
|
// estrae tutti i login dell'utente "user"
|
||||||
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 {
|
||||||
fmt.Printf("LRANGE: %+v - %+v\n\r", err, logs)
|
if opts.Debug {
|
||||||
|
fmt.Printf("LRANGE: %+v - %+v\n\r", err, logs)
|
||||||
|
}
|
||||||
log.Printf("LRANGE: %+v - %+v\n\r", err, logs)
|
log.Printf("LRANGE: %+v - %+v\n\r", err, logs)
|
||||||
}
|
}
|
||||||
// if opts.Debug {
|
// if opts.Debug {
|
||||||
|
@ -50,7 +52,7 @@ func producer(id int) {
|
||||||
|
|
||||||
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\r", 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\r", id, user, len(logs), time.Since(start), dbs.rdb.ActiveCount())
|
||||||
}
|
}
|
||||||
|
|
||||||
count.AddUser()
|
count.AddUser()
|
||||||
|
|
|
@ -3,7 +3,7 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
// "log"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -26,7 +26,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 {
|
||||||
log.Printf("LREM (%d): %s - %d - %+v\n\r", id, rem.user, len(rem.logins), time.Since(start))
|
// log.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\r", id, rem.user, len(rem.logins), time.Since(start))
|
fmt.Printf("LREM (%d): %s - %d - %+v\n\r", id, rem.user, len(rem.logins), time.Since(start))
|
||||||
}
|
}
|
||||||
wg.Done()
|
wg.Done()
|
||||||
|
|
Loading…
Add table
Reference in a new issue