Ignore old notifications
This commit is contained in:
parent
a346a849db
commit
eb82b89571
14
main.go
14
main.go
|
@ -44,6 +44,13 @@ func tickGameStart(c *sn.Client) {
|
||||||
|
|
||||||
for _, n := range mentions {
|
for _, n := range mentions {
|
||||||
|
|
||||||
|
// we only care about current notifications
|
||||||
|
x := time.Now().Add(-30 * time.Second)
|
||||||
|
if n.Item.CreatedAt.Before(x) {
|
||||||
|
log.Printf("ignoring old mention %d\n", n.Item.Id)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
if exists, err := db.ItemHasReply(n.Item.Id, meId); err != nil {
|
if exists, err := db.ItemHasReply(n.Item.Id, meId); err != nil {
|
||||||
log.Printf("failed to check for existing reply to game start in item %d: %v\n", n.Item.Id, err)
|
log.Printf("failed to check for existing reply to game start in item %d: %v\n", n.Item.Id, err)
|
||||||
continue
|
continue
|
||||||
|
@ -88,6 +95,13 @@ func tickGameProgress(c *sn.Client) {
|
||||||
|
|
||||||
for _, n := range replies {
|
for _, n := range replies {
|
||||||
|
|
||||||
|
// we only care about current notifications
|
||||||
|
x := time.Now().Add(-30 * time.Second)
|
||||||
|
if n.Item.CreatedAt.Before(x) {
|
||||||
|
log.Printf("ignoring old reply %d\n", n.Item.Id)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
if exists, err := db.ItemHasReply(n.Item.Id, meId); err != nil {
|
if exists, err := db.ItemHasReply(n.Item.Id, meId); err != nil {
|
||||||
log.Printf("failed to check for existing reply to game update in item %d: %v\n", n.Item.Id, err)
|
log.Printf("failed to check for existing reply to game update in item %d: %v\n", n.Item.Id, err)
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in New Issue