Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Automatically skip and unsub inactive users #78

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jdkaplan
Copy link
Collaborator

@jdkaplan jdkaplan commented Sep 4, 2024

This is a potential implementation of inactive user handling (#75). This is a draft because I have not tested it at all.


From the issue/comments on #75 itself:

PB can keep, for each user, a count of the number of times it has paired that user since the last time the user interacted. That is, an interaction resets the count to 0.

I've called this openPairings here, but I'm very open to alternative names!

We can then add a cron that checks this count for each user.

I chose to hook into the existing pairing cron for this. This gives users as much time as possible to respond to the existing pairing. It's also a time we're already regularly sending out lots of messages.

If it's greater than some threshold (what?),

The consensus seems to be 3, but it's a quick patch to change it :)

we can send a message to that user that says "we've de-registered you for inactivity, but you're welcome to re-register".

Added! I'm still tuning my sense of "writing as Pairing Bot", so feedback is very much welcome!

It would be ideal to give the user a heads up + chance to engage before kicking them off, but I don't know if it's necessary.

I agree! I could see us sending a warning message at max - 1, but I didn't want this to get too complicated before I actually understand the code 😅

I can see some weird edge cases where PB might kick a user off the roster even if that user is going through with the pairing sessions — e.g. they always just DM the other person they were paired with instead of responding to the PB thread.

I've tried to extend the pairing message to indicate that we're looking for chat interaction now, but I struggled to find a great way to word it without making it a whole thing. Help please!

@jdkaplan jdkaplan force-pushed the jdkaplan-auto-unsub-inactive branch from 9cb1749 to 51fe358 Compare September 4, 2024 17:48
@cceckman cceckman self-requested a review September 10, 2024 13:49
@cceckman
Copy link
Collaborator

Added myself as a reviewer to put it on my to-do list!

Copy link
Collaborator

@cceckman cceckman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LG.

Probably good for us to try this out on dev for a bit -- get Pairing Bot to pair us up a couple times and then evict us?

@@ -193,6 +214,18 @@ func (pl *PairingLogic) match(w http.ResponseWriter, r *http.Request) {
if err := pl.pdb.SetNumPairings(ctx, int(timestamp), numPairings); err != nil {
log.Printf("Failed to record today's pairings: %s", err)
}

for _, r := range inactive {
if err := pl.rdb.Delete(ctx, r.id); err != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe: send the message, and then only delete if we successfully sent the message?

I'd hate to see someone "silently" unsubscribed if there's a bug here.

@@ -13,9 +14,14 @@ import (

const owner string = `@_**Maren Beam (SP2'19)**`
const oddOneOutMessage string = "OK this is awkward.\nThere were an odd number of people in the match-set today, which means that one person couldn't get paired. Unfortunately, it was you -- I'm really sorry :(\nI promise it's not personal, it was very much random. Hopefully this doesn't happen again too soon. Enjoy your day! <3"
const matchedMessage = "Hi you two! You've been matched for pairing :)\n\nHave fun!"
const matchedMessage = "Hi you two! You've been matched for pairing :)\n\nHave fun!\n\nNote: In an effort to reduce the frequency of no-show partners, I'll soon start automatically unsubscribing users that I haven't heard from in a while. Please message me back so I know you're an active user (and messages in this chat count!) :heart:"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe: "... in a while. Please reply (or message me separately) so I know you're an active user! ❤️ Thank you!"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants