Running cron in Payload Cloud

default discord avatar
grandnainconnulast year
8

We are currently implementing a sync system with CRON inside our CMS, everything works fine, except once deployed, since we have 2 instances in the cloud, both runs at the same time, and we don't want that.


Is there some ENV variable or something I can do to force only one instance to run CRON tasks?



Know which instance is running on PayloadCloud - Urgent

  • discord user avatar
    denolfe
    last year

    Hmm, this is a tricky one. One option is we could expose configuring instance count for projects. I can look into other possibilities as well, but no other ideas on how to solve it come to mind as of now.



    As of now, we set instance count to 1 for standard plans and 2 for tiers beyond that. Sounds like you're on a Pro plan, correct?

  • default discord avatar
    grandnainconnulast year

    Correct we do!



    We like the fact of having two instances to reduce the load though



    I think we'll simply deploy a route to launch cron tasks externally, whichever one will receive it will take it in charge

  • discord user avatar
    denolfe
    last year

    Yeah, that sounds like a good solution. This is a tricky problem to solve. Let me know if I can help with anything else 👍



    Running cron in Payload Cloud

Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.