Django uwsgi Broken pipe error

uwsgi Broken pipe

Note: 为了方便多处发表所以用了英文
Created: Jul 30, 2019 2:49 PM
Last Edited Time: Aug 02, 2019 9:58 PM
Status: Draft

Issue Description

  1. Happen when saving purchase formset in Supplier Admin page.
1.png

Reason

May cause by the multiple actions of calculating and saving the summary records that every time a purchase record is saved.

Possible Solution

1. Change signal to crontab

Drowback of this approach is:

  1. Can't see the data change right after the user submit new data. Add a [Update Now] botton to manually update
  2. Extra effort to setup crontab on server
  3. Every time restart container may need to restart crontab service

2. Set the max_num to inline formset

This is a workaround, it reduces the times of database writing at the same request. So as to reduce the possibility of Broken pipe or connection timeout!

# apps/purchase/admin.py
class MaterialPurchaseInline(BaseTransactionInline):
    model = MaterialPurchase
    form = MaterialPurchaseInlineForm
    max_num = 10 # <---- also set to BaseTransactionInline

Action Plan

  1. Exame my Hypothesis: Stop the signals submit a 30 records formset, see if error accore.
  • If yes:
    1. Write another view linked to a botton to manually update the record
    2. Create a crontab
  • If Not:
    1. Seek other solution
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi阅读 12,163评论 0 10
  • **2014真题Directions:Read the following text. Choose the be...
    又是夜半惊坐起阅读 13,481评论 0 23
  • 烦恼的一天不是你的 无论你有着什么样的心情 既然牛奶已打翻 哭泣有什么意义? 不要责怪别人 不要埋怨自己 学着忘记...
    白色闪电阅读 1,027评论 0 1
  • “你也没有做过流产,也没有做过大手术,怎么身体这么虚?” “……” “而且你应该之前也吃中药调理过。” “嗯。” ...
    Sunshine云阅读 1,118评论 0 0
  • 今天大盘收到周末整顿打击互联网金融利空影响直接跳空低开早盘就放量回补了3036点缺口,然后全天在低位地量震荡运行,...
    阿凯古阅读 3,237评论 0 1