Most settings, the key is paying attention to indicators of interest/disinterest. If someone isn’t engaging with you beyond grunts, looks visibly uncomfortable, etc. that’s your cue to gracefully exit.
This is the hard part for a lot of people, properly gauging interest after initiation and knowing when to move on. If it’s not intuitive, unfortunately there’s not much else you can do to improve this other than practice.
Am middle-aged(ish) nerd, can confirm this would work.