unbit/uwsgi — pull request #292 by prymitive (2013-05-23 09:21:34+00:00)
Title: unique crons, fixes #227

```
$ uwsgi -s :0 -M --unique-cron "-1 -1 -1 -1 -1 sleep 70" --cron "-1 -1 -1 -1 -1 sleep 80" --logdate
[...]
Thu May 23 11:11:20 2013 - [uwsgi-cron] running "sleep 70" (pid 14369)
Thu May 23 11:11:20 2013 - [uwsgi-cron] running "sleep 80" (pid 14370)
Thu May 23 11:12:20 2013 - [uwsgi-cron] running "sleep 80" (pid 14376)
Thu May 23 11:12:30 2013 - [uwsgi-cron] command "sleep 70" running with pid 14369 exited after 70 second(s)
Thu May 23 11:12:31 2013 - [uwsgi-cron] running "sleep 70" (pid 14378)
Thu May 23 11:12:40 2013 - subprocess 14370 exited with code 0
Thu May 23 11:13:20 2013 - [uwsgi-cron] running "sleep 80" (pid 14380)
Thu May 23 11:13:40 2013 - subprocess 14376 exited with code 0
Thu May 23 11:13:41 2013 - [uwsgi-cron] command "sleep 70" running with pid 14378 exited after 70 second(s)
Thu May 23 11:13:42 2013 - [uwsgi-cron] running "sleep 70" (pid 14382)
Thu May 23 11:14:20 2013 - [uwsgi-cron] running "sleep 80" (pid 14384)
Thu May 23 11:14:40 2013 - subprocess 14380 exited with code 0
Thu May 23 11:14:52 2013 - [uwsgi-cron] command "sleep 70" running with pid 14382 exited after 70 second(s)
Thu May 23 11:14:53 2013 - [uwsgi-cron] running "sleep 70" (pid 14386)
Thu May 23 11:15:20 2013 - [uwsgi-cron] running "sleep 80" (pid 14391)
```

Note that overlapping --cron tasks (non unique) will eat up pids stored at uwsgi_cron->pid for already running instance, so for such late commands we will get ```subprocess 14380 exited with code 0``` instead of pretty ```[uwsgi-cron] command "sleep 70" running with pid 14382 exited after 70 second(s)```.
But we would need to store all pids of executed commands and that just doesn't sound like a good idea.