unbit/uwsgi — pull request #90 by prymitive (2012-12-17 23:42:20+00:00)
Title: new option to define minimum worker reload interval

This patch adds new option that can be used to protect from workers being reloaded (due to max requests or memory usage) to fast. It allows to set a minimum interval between reloads.
Default is set 30 seconds but use whatever value You prefer as default if You dislike it.

Tested with:
```./uwsgi --master --http :8080 --wsgi-file tests/staticfile.py --disable-logging --logdate --max-requests 1```

Before:
```
Tue Dec 18 00:34:32 2012 - ...The work of process 12146 is done. Seeya!
Tue Dec 18 00:34:32 2012 - Respawned uWSGI worker 1 (new pid: 12149)
Tue Dec 18 00:34:32 2012 - ...The work of process 12149 is done. Seeya!
Tue Dec 18 00:34:33 2012 - Respawned uWSGI worker 1 (new pid: 12150)
Tue Dec 18 00:34:33 2012 - ...The work of process 12150 is done. Seeya!
Tue Dec 18 00:34:34 2012 - worker respawning too fast !!! i have to sleep a bit (2 seconds)...
Tue Dec 18 00:34:36 2012 - Respawned uWSGI worker 1 (new pid: 12151)
Tue Dec 18 00:34:36 2012 - ...The work of process 12151 is done. Seeya!
Tue Dec 18 00:34:37 2012 - Respawned uWSGI worker 1 (new pid: 12152)
Tue Dec 18 00:34:37 2012 - ...The work of process 12152 is done. Seeya!
Tue Dec 18 00:34:38 2012 - worker respawning too fast !!! i have to sleep a bit (2 seconds)...
Tue Dec 18 00:34:40 2012 - Respawned uWSGI worker 1 (new pid: 12153)
Tue Dec 18 00:34:40 2012 - SIGPIPE: writing to a closed pipe/socket/fd (probably the client disconnected) on request / (ip 127.0.0.1) !!!
Tue Dec 18 00:34:40 2012 - sendfile(): Broken pipe [core/sendfile.c line 105]
Tue Dec 18 00:34:40 2012 - ...The work of process 12153 is done. Seeya!
Tue Dec 18 00:34:41 2012 - Respawned uWSGI worker 1 (new pid: 12154)
```

After
```
Tue Dec 18 00:32:29 2012 - ...The work of process 11701 is done. Seeya!
Tue Dec 18 00:32:29 2012 - Respawned uWSGI worker 1 (new pid: 11704)
Tue Dec 18 00:32:59 2012 - ...The work of process 11704 is done. Seeya!
Tue Dec 18 00:32:59 2012 - Respawned uWSGI worker 1 (new pid: 11705)
Tue Dec 18 00:33:29 2012 - ...The work of process 11705 is done. Seeya!
Tue Dec 18 00:33:29 2012 - Respawned uWSGI worker 1 (new pid: 11706)
```