Re: Database viewpoint of subject - Sending e-mails from database table with Cronjob

Поиск
Список
Период
Сортировка
От A B
Тема Re: Database viewpoint of subject - Sending e-mails from database table with Cronjob
Дата
Msg-id h2xdbbf25901004210435q92905396xd8cdfcf9aca3e2fc@mail.gmail.com
обсуждение исходный текст
Ответ на Database viewpoint of subject - Sending e-mails from database table with Cronjob  (Andre Lopes <lopes80andre@gmail.com>)
Ответы Re: Database viewpoint of subject - Sending e-mails from database table with Cronjob  (Andre Lopes <lopes80andre@gmail.com>)
Список pgsql-general
> I generate e-mail messages to a database table and then with a CronJob I
> sent the e-mails.
>
> My doubt is... The CronJob runs every 10 minutes, but If I have 100.000
> e-mails to send the script will not be able to send all the 100.000 e-mails
> in 10 minutes.
>
> How can I deal with this problem? There is no problem to have multiple
> CronJobs runing in background?

If N is the number of mails you can send per cronjob in 10 minutes,
then run 100 000/N cron jobs.
You will be very happy if you also add som kind of "sleep" (for a
growing number of seconds) to the cronjobs when there are currently no
more mails to send. Otherwise you will end up with a very annoying CPU
load.

The other way is to let the cron job spawn new processes (up to a
limited number of child proceses) as long as there are mails to send.
These child processes runs as long as there are mails to send, then
they die. The cron job will then mostly do process controll/start new
processes.

That ought to do the trick.

В списке pgsql-general по дате отправления:

Предыдущее
От: Leonardo F
Дата:
Сообщение: Performance impact of hundreds of partitions
Следующее
От: Andre Lopes
Дата:
Сообщение: Re: Database viewpoint of subject - Sending e-mails from database table with Cronjob