don't do work for stale requests

This commit is contained in:
Ted Unangst 2019-10-30 17:23:02 -04:00
parent 31a960b0d1
commit 40fb10d25a
1 changed files with 2 additions and 2 deletions

4
web.go
View File

@ -1071,7 +1071,7 @@ func zonkit(w http.ResponseWriter, r *http.Request) {
if wherefore == "ack" { if wherefore == "ack" {
xonk := getxonk(userinfo.UserID, what) xonk := getxonk(userinfo.UserID, what)
if xonk != nil { if xonk != nil && !xonk.IsAcked() {
_, err := stmtUpdateFlags.Exec(flagIsAcked, xonk.ID) _, err := stmtUpdateFlags.Exec(flagIsAcked, xonk.ID)
if err != nil { if err != nil {
log.Printf("error acking: %s", err) log.Printf("error acking: %s", err)
@ -1083,7 +1083,7 @@ func zonkit(w http.ResponseWriter, r *http.Request) {
if wherefore == "deack" { if wherefore == "deack" {
xonk := getxonk(userinfo.UserID, what) xonk := getxonk(userinfo.UserID, what)
if xonk != nil { if xonk != nil && xonk.IsAcked() {
_, err := stmtClearFlags.Exec(flagIsAcked, xonk.ID) _, err := stmtClearFlags.Exec(flagIsAcked, xonk.ID)
if err != nil { if err != nil {
log.Printf("error deacking: %s", err) log.Printf("error deacking: %s", err)