小编ani*_*hek的帖子

当uWSGI需要很长时间来处理请求时,Nginx超时

我有Python Django应用程序的Nginx + uWSGI.

我有以下内容nginx.conf:

location / {
    include uwsgi_params;
    uwsgi_pass   127.0.0.1:9001;
    uwsgi_read_timeout 1800;
    uwsgi_send_timeout 300;
    client_header_timeout 300;
    proxy_read_timeout 300;
    index  index.html index.htm;
}
Run Code Online (Sandbox Code Playgroud)

但是对于uWSGI上长时间运行的请求大约需要1分钟才能完成,我在Nginx错误日志中会出现超时错误,如下所示:

2013/04/22 12:35:56 [错误] 2709#0:*1上游超时(110:连接超时)从上游读取响应头,客户端:xx.xx.xx.xx,server :, request :"GET/entity/datasenders/HTTP/1.1",上游:"uwsgi://127.0.0.1:9001",主机:"xxx.xx.xx.x"

我已经设置了标头超时和uWSGI发送/读取超时到5分钟,有人可以告诉我我能做些什么来克服这个问题?

configuration nginx connection-timeout uwsgi

36
推荐指数
2
解决办法
4万
查看次数

如何防止Sequelize使用Postgres为主键插入NULL

我在postgresql 9中创建了一个表

create table stillbirth(id serial primary key, state varchar(100), count int not null, year int not null); 
Run Code Online (Sandbox Code Playgroud)

尝试使用sequelize 1.4.1版本在node.js上编写示例.

将上表映射为

var StillBirth = sequelize.define('stillbirth',
{ id: {type: Sequelize.INTEGER, primaryKey: true, autoIncrement: true},
state: Sequelize.STRING,
year: Sequelize.INTEGER,
count: Sequelize.INTEGER
}, {timestamps: false, freezeTableName: true});
Run Code Online (Sandbox Code Playgroud)

现在,当我尝试创建一个新的死产实例并保存它时,我得到错误.

/**新实例创建代码**/

StillBirth
   .build({state: objs[j].state, year: objs[j].year, count: objs[j].count})
   .save()
   .error(function(row){
         console.log('could not save the row ' + JSON.stringify(row));
        })
   .success(function(row){
       console.log('successfully saved ' + JSON.stringify(row));
   })
Run Code Online (Sandbox Code Playgroud)

我得到的错误

*执行:INSERT INTO"死产"("州","年","计数","id")价值('Andhra Pradesh',2004,11,NULL)返回; 无法保存行{"length":110,"name":"error","severity":"ERROR","code":"23502","file":"execMain.c","line": "1359", "程序": "ExecConstraints"} …

postgresql node.js sequelize.js

10
推荐指数
1
解决办法
8929
查看次数