Discord Bot Free Trial: Sleep or Always Active?
syaqws
FREEOP

3 months ago

Does the free trial keep a Discord bot running 24/7, or will the service sleep when idle? I'm new to this, and I started this project 2 months ago. I want to know whether I should get the Hobby plan despite using fewer $ credits (literally less than $1).

$10 Bounty

2 Replies

Railway
BOT

a month ago

This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.

Status changed to Open Railway about 1 month ago


rishisim
HOBBYTop 10% Contributor

11 days ago

A normal Railway service should not sleep just because it is idle. Railway's default service model is a persistent/long-running service; sleeping only happens when you enable Serverless for that service. The Serverless docs say it was formerly called App Sleeping and that Railway considers a service inactive only after it sends no outbound packets for 10+ minutes: https://docs.railway.com/reference/app-sleeping

For a Discord bot, you generally do not want Serverless enabled. A bot keeps an outbound gateway/WebSocket connection to Discord, which is exactly the kind of outbound traffic that prevents sleep. If it did sleep, the bot would disconnect, and Railway wakes slept services from inbound internet/private-network traffic; that is not a good fit for a bot that needs to stay connected 24/7.

So the practical answer is:

1. If Serverless/App Sleeping is OFF, your bot is intended to stay running 24/7 while the workspace has credits/is in good standing.

2. On the trial/free side, the limiting factor is credits and plan limits, not automatic idle sleep. Railway's pricing docs describe the trial/free credits and the Hobby plan's included usage: https://docs.railway.com/reference/pricing/plans

3. If your bot uses less than $1/month, Hobby still has the $5/month minimum, but that $5 includes the first $5 of usage. You would upgrade if you need the bot to keep running beyond trial/free limitations or want paid-plan limits/reliability.

4. To avoid surprise spend, set usage limits/resource limits rather than turning on Serverless for a Discord bot: https://docs.railway.com/pricing/cost-control

Short version: leave Serverless off for a 24/7 Discord bot. It should remain active until you run out of credits/usage allowance or hit a plan/account limit.


i-smuglov
FREETop 5% Contributor

11 days ago

I was able to make a relatively simple Discord bot with a WebSocket connection, but that required some additional code and lots of code/memory optimizations to keep it running under $1/mo.

What you can do:

  1. Somehow keep your packets sending (easy when the bot receives signals from Discord often)
  2. If you use DB - it can sleep, but we want to wake it up, and only read/write when it is up)
  3. The most expensive part is RAM/minute; you need to keep it under ~50MB, or even lower if your bot is up 24/7.

The question is what will happen to a fully sleeping bot when it receives a "message". I haven't tested it yet. Railway, in theory, should wake it up and still forward the "message", but we want to confirm that.

If someone solves your problem, be a good community member and mark their reply as the solution <3


Welcome!

Sign in to your Railway account to join the conversation.

Loading...