include userid in doover queries
This commit is contained in:
parent
4fe838f5ed
commit
3baff9e64e
|
@ -1193,6 +1193,6 @@ func prepareStatements(db *sql.DB) {
|
||||||
stmtSaveChonk = preparetodie(db, "insert into chonks (userid, xid, who, target, dt, noise, format) values (?, ?, ?, ?, ?, ?, ?)")
|
stmtSaveChonk = preparetodie(db, "insert into chonks (userid, xid, who, target, dt, noise, format) values (?, ?, ?, ?, ?, ?, ?)")
|
||||||
stmtLoadChonks = preparetodie(db, "select chonkid, userid, xid, who, target, dt, noise, format from chonks where userid = ? and dt > ? order by chonkid asc")
|
stmtLoadChonks = preparetodie(db, "select chonkid, userid, xid, who, target, dt, noise, format from chonks where userid = ? and dt > ? order by chonkid asc")
|
||||||
stmtGetChatters = preparetodie(db, "select distinct(target) from chonks where userid = ?")
|
stmtGetChatters = preparetodie(db, "select distinct(target) from chonks where userid = ?")
|
||||||
stmtDeliquentCheck = preparetodie(db, "select dooverid, msg from doovers where rcpt = ?")
|
stmtDeliquentCheck = preparetodie(db, "select dooverid, msg from doovers where userid = ? and rcpt = ?")
|
||||||
stmtDeliquentUpdate = preparetodie(db, "update doovers set data = ? where dooverid = ?")
|
stmtDeliquentUpdate = preparetodie(db, "update doovers set msg = ? where dooverid = ?")
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,10 +68,10 @@ func sayitagain(doover Doover) {
|
||||||
|
|
||||||
var dqmtx sync.Mutex
|
var dqmtx sync.Mutex
|
||||||
|
|
||||||
func delinquent(rcpt string, msg []byte) bool {
|
func delinquent(userid int64, rcpt string, msg []byte) bool {
|
||||||
dqmtx.Lock()
|
dqmtx.Lock()
|
||||||
defer dqmtx.Unlock()
|
defer dqmtx.Unlock()
|
||||||
row := stmtDeliquentCheck.QueryRow(rcpt)
|
row := stmtDeliquentCheck.QueryRow(userid, rcpt)
|
||||||
var dooverid int64
|
var dooverid int64
|
||||||
var data []byte
|
var data []byte
|
||||||
err := row.Scan(&dooverid, data)
|
err := row.Scan(&dooverid, data)
|
||||||
|
@ -93,7 +93,7 @@ func delinquent(rcpt string, msg []byte) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
func deliverate(userid int64, rcpt string, msg []byte) {
|
func deliverate(userid int64, rcpt string, msg []byte) {
|
||||||
if delinquent(rcpt, msg) {
|
if delinquent(userid, rcpt, msg) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
var d Doover
|
var d Doover
|
||||||
|
|
Loading…
Reference in New Issue