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