Interaction already replied on bot restart

Hello, I am getting the interaction already replied when my bot re-deploys after changes are pushed to github.

It seems that two instances of the bot are probably running for a split second causing one bot to reply and the other to error out as the interaction has been replied to.

This only happens if I run a command as soon as it's deployed - if I wait a little its fine (presumably the other bot is dead by then)

I am using Digital Ocean. See the code below for termination:

const handleTermination = async () => {
    Logger.info('Terminating bot...');
    try {
        client.removeAllListeners();
        await closeMongooseConnection();
        await client.destroy();
        Logger.info('Cleanup complete. Exiting...');
        process.exit(0);
    } catch (error) {
        Logger.error('Error during termination:', error);
        process.exit(1);
    }
};

process.on('SIGINT', handleTermination);
process.on('SIGTERM', handleTermination);


I see a SIGTERM signal should be sent by DO but I don't see any of my logging in the runtime logs, the bot just restarts.

Do I need to change anything in my bot code? Or change my DO setup? Any help appreciated!
Was this page helpful?