8
Konsole
6y

Guess why the tokens were being piled up...

Comments
  • 3
    One of my previous jobs had a similar issue, except it was actually a design choice by the OAuth2 library (Doorkeeper).

    I purged all of the expired tokens and reduced the database size by about 55%. Size, not rowcount. Over half the database was useless oauth2 garbage.

    I yelled at the maintainers, but they didn't care.
  • 0
    @Root 55%.. Damn... From how long was this going on..
  • 1
    @Root In this case, the code is abt an year old and the dev "forgot" to make a cron, after writing a todo 😑
  • 1
    @Root And what do you mean by didn't care...😮
    50% db size seems a lot to care about
  • 0
    @Konsole The server was primarily a login server for both a game and third-party clan/fan sites, and was live for 3-4 years, so 55% made sense.

    Why didn't the maintainers care? They didn't think it would ever be an issue. and if it was, you just could clear them out manually. After, you know, figuring out how. 🙄
  • 2
    If there's one thing one learned, then it's that todo is short for never... Man, at least write it down so that we can give it the lowest possible priority and stop pretending like we're going to do it.
  • 2
    @ihatecomputers
    "Hmmm, I'm bored. What to do..."
    `grep TODO * -r | more`
    ... nope. Nope nope nope. screw that. It's Netflix time.
  • 0
    @Root @ihatecomputers Just asking... Are TODOs really used in actual projects out there?
  • 0
    @Konsole I've encountered them almost everywhere.
  • 1
    @Konsole I see them all the time! Especially in the parts that no one wants to touch 🤔 it's fun reading things like "temporary", "soon...", "fix when..." and then seeing that the comment is five years old. Classic.
  • 0
    Hey here's an idea...

    Every time a user logs in, check if x minutes/ hours/ etc. hasp passed since last token cleanup. If it has, start a token cleanup process.

    No need for cron.
  • 0
    @AlgoRythm Won't that be too intensive. Say 100 users login in span of an hour, there really isn't a need to check 4 expired tokems
Add Comment