是否有可能让uwsgi重新启动500个错误

我偶尔会遇到数据库将重新启动或类似的问题。 在这些情况下,我需要进入并手动重新启动uwsgi

可以设置uwsgi重启500错误吗? 理想情况下,我可以让工作人员重新启动500个错误,而不是每个错误。

您可以使用度量子系统,添加计算500个错误的度量。

度量标准可以有一个阈值触发警报(在你的情况下重新加载)

[uwsgi] http-socket = :9092 ; reload the instance when touching touch-reload = /tmp/restart ; create a new alarm restarting the instance alarm = database_reloaded cmd:touch /tmp/restart ; create a metric for couting 500s metric = 500counter ; create a metric threshold, resetting the metric to 0 when hitting 5 ; the metric alarm triggers the restart of the instance too metric-alarm = key=500counter,value=5,alarm=database_reloaded,rate=60,reset=0 ; increment metric whenever a 500 is generated final-route-status = 500 metricinc:500counter