Repls keep running by themselves - how do I stop this behavior?

For some reason my repls keep running on their own. It usually happens when I have a repl open in my browser from the night before, and power up my computer. The repl, which is still in one of my browser windows usually refreshes the page - and then starts running by itself! (without me pressing the run button!)

The repl was stopped the night before and I most certainly did not push the run button. How can I stop this behavior? This is extremely problematic for my setup.

I’m not sure. Do you have Always On turned on or have you Deployed it? Also if the repl hosts a website and someone accesses the website that will wake it up. Otherwise they can’t access the website. You can comment out all your code (Ctrl+A then Ctrl+/) if you really want to stop that.

How so?

1 Like

Always on is off and it is deployed. It is not a website, it is a trading bot. Commenting out code sounds like a very tedious manual solution that I will eventually forget one day.

It is very problematic because it is a trading bot that trades real money. When it runs in the regular editor window it buys and sells assets that it should not be trading because it duplicates everything in the deployment.

I sometimes experience the same thing (chromebook).

Steps (I think):
On a chromebook, open a repl in the editor on a new tab.
Close the chromebook lid, which sleeps the computer.
After a while, open the lid and sign back in from the lock screen.
Now, the repl is disconnected but starts trying to reconnecting. Right after it reconnects, the repl runs as if the run button was clicked, so I have to click stop.

I think these steps cause it, but I am not certain and haven’t tested them. There might be some extra steps like being on another tab when closing lid or letting chrome “unload” the tab (to save memory) before closing lid.

2 Likes

FYI - this is intended behavior. :slight_smile:

1 Like

Ah okay. Is there a specific reason why my python repls need to start running on their own though?

Actually I misunderstood the question, not sure if it’s intended behavior.

This is why you should always read the whole thing, lol. :slight_smile:

1 Like

Why is this intended behavior? If I wanted to run the code I would click on the run button, it should not run on its own. How can I turn this off?

These are exactly the same steps for me.

You can’t afaIk. You could make a post in Feature Requests but don’t expect it to be added soon. Best you can do is:

Or change your code so it only runs if you type something into the Console, instead of as soon as you press the run button.

This is good advice.

Why do you have a bot that manages real money that automatically runs when the repl runs? It should definitely have an Okay button or something. If this is a website then it certainly needs authentication otherwise even if it’s a private repl theoretically someone could guess the URL and run the bot.

1 Like

This will not work because I can’t type in “okay” in the console when it deploys. I guess commenting out is the only viable option right now…

An alternative to commenting code is perhaps throwing an exception?

2 Likes

Can you provide the link to your repl so we can better give insight? Or is it private? At least can you tell us what language(s) it’s using?

1 Like

or even exit(). Or by changing the run entry in the .replit file while keeping the [deployments] section intact.

2 Likes

@RobertGrzesik if you only want to run when Deployed, this seems like the best advice so far.

3 Likes

The specific one I’m talking about is private, but here’s an example one that’s simpler: https://replit.com/@RobertGrzesik/Lumiwealth-Lumibot-Setup?v=1

I think I came up with a good solution though: Environment variables. I can have my live credentials on my deployment but fake/paper trading credentials in my regular dev environment. Honestly this is still a little annoying, but keeping separate ENV vars should be pretty simple.

THANK YOU VERY MUCH GUYS! Honestly it’s amazing how many of you responded to this and how quickly, the community here is amazing.

1 Like

Deployments are meant to keep things running. If you only want to run it manually I wouldn’t deploy it.

This is actually the opposite. I don’t ever want it to run manually, I only want it to stay running in a deployment. I have no desire to click the run button, I only want to use deployments.

Ah I think I understand. You want it running via a deployment but not also simultaneously running via the workspace.