hey I have implementing a new feature on a component, anytime I create a component, there is this field with a default value of true, then at every day at midnight, it pass to false
my goal is to tell to my user if this composent is new or old (in the frontend)
so I add this code in the backend in order to do that
the code is working (in local not in production) so before I push it in prod, I just anted to know if it is the good way or is there a way to do it cleaner ? thank you
N.B. my app is already deployed on heroku
Actually isNew is not for articles, I have to know if the composant inside the article is new or not, and there is no created_at or published_at when I add a composant
So for example I have this article, what I want is to whenever I add a retailer_info composant inside my article, to know if it is a new one or not. To do that I add a “isnew” field which is by default set as true and I change it to false every day with cron. But I want to display “isnew” in the frontend so if there is a way to do it with published_at or created_at I take it It is how I do but I don’t know if it the good way aha
Hi Gabriel, im developing something and im deploying it on Heroku, i have a cron job that runs well in local, but on heroku does not work , or i see it’s not running, is there something else that i have to set up before?
I would advise against trying to use the built-in cronjobs while using heroku, much like the reason why we don’t support the CTB or SQLite on Heroku: Troubleshooting - Strapi Developer Documentation
Heroku instances have a limited lifetime, typically only a few hours before they go to “sleep”. At the point of sleeping the instance is effectively killed and no longer running, meaning cronjobs aren’t running. When Heroku detects new traffic, it spins up a new instance, pulls the code from Git, and cold boots the project.
Meaning if your instance is “sleeping” when your cronjob is supposed to run, it won’t. Attempting to force the instance from going to sleep will not be possible as Heroku specifically states they will forcefully kill the instance: Free Dyno Hours | Heroku Dev Center