DEV Community

Cover image for Fixing the Render Free Tier Sleep Issue for Strapi CMS
shubham paul
shubham paul

Posted on

1

Fixing the Render Free Tier Sleep Issue for Strapi CMS

I am working on a project where the backend is deployed on Render, using Strapi CMS. One challenge with the Render free tier is that the server goes to sleep after 15 minutes of inactivity. This causes delays when developing the frontend, as the data takes too long to load initially, slowing down my development process.

To address this, I thought of a solution: pinging the server every 10 minutes to prevent it from going to sleep. This way, the response times will remain optimal. I wrote a basic JavaScript program to achieve this.
Let's see the code

import axios from "axios";
let i = 1;
async function apiCronJob(){
    try{
            const data = await axios.get("your server endpoitn");
            if(data){
                console.log("request number is: ",i)
            }
            i++;
    }
    catch(e){
            console.log(e)
    }
}


setInterval(apiCronJob,600000);

Enter fullscreen mode Exit fullscreen mode

You can run this code in your computer are make a cron job or worker that will run code.

Comment down your solutions

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

Top comments (0)

Cloudinary image

Optimize, customize, deliver, manage and analyze your images.

Remove background in all your web images at the same time, use outpainting to expand images with matching content, remove objects via open-set object detection and fill, recolor, crop, resize... Discover these and hundreds more ways to manage your web images and videos on a scale.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay