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