Together-Java / TJ-Bot

TJ-Bot is a Discord Bot used on the Together Java server. It is maintained by the community, anyone can contribute.
https://togetherjava.org
GNU General Public License v3.0
100 stars 83 forks source link

HelpThreadAutoArchiver can't find author from database #1067

Closed SquidXTV closed 4 months ago

SquidXTV commented 4 months ago

About

Since the new release, this error comes up a lot of times. Might be worth looking into.

stacktrace

SquidXTV commented 4 months ago

Note

Couldn't reproduce yet, might be a problem with prod environment. Like thread got created while bot was down and now missing the database entry created by:

Optional<Long> getAuthorByHelpThreadId(final long channelId) {

    logger.debug("Looking for thread-record using channel ID: {}", channelId);

    return database.read(context -> context.select(HelpThreads.HELP_THREADS.AUTHOR_ID)
        .from(HelpThreads.HELP_THREADS)
        .where(HelpThreads.HELP_THREADS.CHANNEL_ID.eq(channelId))
        .fetchOptional(HelpThreads.HELP_THREADS.AUTHOR_ID));
}