all repos — honk @ a730f32767264505de21afb8d92e0275246ae4db

my fork of honk

include userid in doover queries
Ted Unangst tedu@tedunangst.com
Mon, 12 Jun 2023 15:08:09 -0400
commit

a730f32767264505de21afb8d92e0275246ae4db

parent

0e231e7045b770837ab7f5f8d1acbae29f047a1a

2 files changed, 5 insertions(+), 5 deletions(-)

jump to
M database.godatabase.go

@@ -1193,6 +1193,6 @@ stmtGetTracks = preparetodie(db, "select fetches from tracks where xid = ?")

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") stmtGetChatters = preparetodie(db, "select distinct(target) from chonks where userid = ?") - stmtDeliquentCheck = preparetodie(db, "select dooverid, msg from doovers where rcpt = ?") - stmtDeliquentUpdate = preparetodie(db, "update doovers set data = ? where dooverid = ?") + stmtDeliquentCheck = preparetodie(db, "select dooverid, msg from doovers where userid = ? and rcpt = ?") + stmtDeliquentUpdate = preparetodie(db, "update doovers set msg = ? where dooverid = ?") }
M deliverator.godeliverator.go

@@ -68,10 +68,10 @@ }

var dqmtx sync.Mutex -func delinquent(rcpt string, msg []byte) bool { +func delinquent(userid int64, rcpt string, msg []byte) bool { dqmtx.Lock() defer dqmtx.Unlock() - row := stmtDeliquentCheck.QueryRow(rcpt) + row := stmtDeliquentCheck.QueryRow(userid, rcpt) var dooverid int64 var data []byte err := row.Scan(&dooverid, data)

@@ -93,7 +93,7 @@ return true

} func deliverate(userid int64, rcpt string, msg []byte) { - if delinquent(rcpt, msg) { + if delinquent(userid, rcpt, msg) { return } var d Doover