A-Kimpton / go-kimpton-dclonetracker

A discord bot for getting dclone alerts
2 stars 3 forks source link

Duplicate Notifications #2

Closed JSterling8 closed 2 years ago

JSterling8 commented 2 years ago

The bot sends the same message multiple times despite no change in status:

image

A-Kimpton commented 2 years ago

Hi - this can happen when someone sets the status that the progress is 6/6 when it is not - and usually someone else will correct it. This flipping can cause multiple alerts.

Sadly I didn't think of a convenient way of handling troll updates without delaying the updates - perhaps I may add a delay to the 6/6 notification as it would have been too late to join anyway.

JSterling8 commented 2 years ago

@A-Kimpton - Can we reopen this?

I think a simple solution might be not letting the tracker go to 6/6 if it was already at 6/6 (for that specific region, ladder/nonladder, hardcore/softcore), within the past 5 minutes? This would eliminate almost all the duplicates I've seen. I think most of the time it is people reporting the walk late on accident, rather than malicious.

Perhaps we could introduce a "Last Walks" map where the key is REGION|LADDER|HCSC and the value is the last walk time we've seen (expressed as an epoch timestamp), like this:

{
"US|LADDER|SC" : 1652547205,
"US|NONLADDER|SC" : 1652162218,
etc. 
}

We could initialize this map with values of 0 for all entries at startup, then populate them whenever we see a walk. Then when we see a walk on the API (6/6 status), we just check the relevant key and do if (current_epoch_time - last_walk_epoch_time > five_minutes_in_seconds): doStuff(); else: ignore()