Project instance running twice
Having an issue where my project is running twice. I've ran it on my computer and it runs once. Dont know what to do from here
Solution:Jump to solution
youre running a flask app that is starting two processes, thus starting two bots
42 Replies
Project ID:
8d69af02-8b2e-4480-ab5e-c0ac7c80ebd6
what makes you think it's running twice?
8d69af02-8b2e-4480-ab5e-c0ac7c80ebd6
I'm not sure. I've disabled private networking but that didn't solve it
where does private networking come into this issue?
I dont know I just thought It would fix something. Again I've ran the code on my computer and it ran once
what makes you think it's running twice on railway?
Like I said I don't know. Thats why I am asking for help
I'm not sure what I can do for you here if you don't know what the issue is
The issue is that its starting twice. I'm not sure what else you want me to say?
what makes you think it's starting twice?
Railway thats what
what about railway?
Idk what do you want me to say if you're just gonna keep asking me the same question when I am giving you an answer
you are not answering the question, you claim it's running twice, what has made you come to that conclusion?
It keeps logging on to discord twice
It as in my bot
are there anything in the logs that would indicate it's running twice
Didn't understand the question earlier sorry about that. But yeah, heres the instance logging in twice in railway
are you running two replicas?
No
do you know what a replica is?
Yeah this
are you using nixpacks or a dockerfile
It is using nixpacks as the default
build logs please - https://bookmarklets.up.railway.app/log-downloader/
deploy logs please
how do you start the bot locally
Just running python3 main.py
send the main.py file
Oh shit
Solution
youre running a flask app that is starting two processes, thus starting two bots
That was the dev code but its the same
Alright Ill try to find a work around
you where using environment variables for the discord token, do the same for the database too haha
Oh shoot
Yeah I guess I exposed my self there too
you will also need to be using gunicorn for a flask app, but you still need to fix the underlying code issue first
Gunicorn?
yes
you are currently running flask in development mode, and while thats not the main issue, it is still an issue
My problem has been fixed.
Thank you so much and sorry for not understanding the question earlier
make sure you are now using gunicorn too
as your logs have said -
Yeah I am
Alright got no other questions
sounds good