0

I'm currently building an app that includes sales promotions. There is an option in the promotion that allows the manager to have a start and end date. I do not want the manager to have to manually select the winner, but I want my software to read that the end date was reached and auto close the promotion.

This sounds like a job for cron.

These are my options:

  1. At night, run a single script that pulls all promotions across my entire database and updates promotions that have completed.
  2. At the creation of the promotion record, queue up a cron to run at the custom end date.
  3. Force the user to manually update promotion.

Any advice or previous experience would be greatly appreciated!

1

In my experience you want to make sure your application fulfills the following key tests

  • When you run it, it searches for everything that needs doing and does it.

  • If you run two or more instances at the same time. nothing breaks and the work gets done as normal.

  • If it crashes half way through, nothing bad happens and you can just run it again.

  • You have some way of excluding things from its search. So you can tell it to ignore promotion X for example.

  • You have a way to set a manual approval/publish step before the results are sent out to live customers. You can turn this off once you are sure of the process, but to begin with it is vital.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.