implementato bulk insert con _id generato
This commit is contained in:
parent
c2a5e09323
commit
d7d68f4bf4
8 changed files with 71 additions and 85 deletions
12
producer.go
12
producer.go
|
@ -15,11 +15,11 @@ type produced struct {
|
|||
logins []string
|
||||
}
|
||||
|
||||
func producer(id int) {
|
||||
func producer() {
|
||||
conn := dbs.rdb.Get()
|
||||
defer conn.Close()
|
||||
|
||||
for loop[id] {
|
||||
for loop {
|
||||
|
||||
start := time.Now()
|
||||
// estrae un userid dalla lista degli utenti che hanno fatto login
|
||||
|
@ -53,19 +53,19 @@ func producer(id int) {
|
|||
// }
|
||||
|
||||
if opts.Debug {
|
||||
fmt.Printf("PROD (%d): user=%s login=%d in %v - conn=%d\n", id, user, len(logs), time.Since(start), dbs.rdb.ActiveCount())
|
||||
fmt.Printf("PROD: user=%s login=%d in %v - conn=%d\n", 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()
|
||||
wg.Add(1)
|
||||
count.AddWG(id)
|
||||
count.AddWG()
|
||||
|
||||
consume[id] <- produced{
|
||||
consume <- produced{
|
||||
user: user,
|
||||
logins: logs,
|
||||
}
|
||||
}
|
||||
|
||||
done[id] <- true
|
||||
done <- true
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue