Python论坛  - 讨论区

标题:[python-chinese] web程序的并发控制

2007年10月22日 星期一 23:46

leopay leopay在gmail.com
星期一 十月 22 23:46:57 HKT 2007

±È·½ËµÓû§´´½¨Ò»¸öÏà²áºó£¬ÔÊÐíÿ¸öÏà²á×î¶àÖ»ÄÜ´«5ÕÅÕÕÆ¬(ÕâÖ»ÊǸö¼ÙÉè)

Óû§ÉÏ´«Ê±²¢·¢Ìá½»£¬ÔõÑù¿ØÖÆÕâ¸öÏà²áµÄÕÕÆ¬Êý²»³¬¹ý5.

¼ÙÉèÒѾ­ÉÏ´«ÁË4ÕÅͼƬÁË¡£
È»ºó£¬
A½ø³ÌÇëÇóÉÏ´«Ê±£¬´ÓÊý¾Ý¿âÀï¶ÁÈ¡Õâ¸öÏà²áÊý¾Ý£¬ÅжϿÉÒÔ½ÓÊÜÕâ´Î£¬Òò´Ë¿ªÊ¼ÉÏ´«¡£
ÓÚ´Ëͬʱ£¬B½ø³ÌÒ²¿ªÊ¼ÉÏ´«ÇëÇó£¬Í¬ÑùÅжϿÉÒÔ½ÓÊÜÕâ´ÎÉÏ´«£¬¿ªÊ¼ÉÏ´«¡£
ÕâÑù¾Íµ¼ÖÂÁË×îÖÕÕâ¸öÏà²áµÄÕÕÆ¬Êý´óÓÚÁË5.Ò²¾ÍÊdzöÏÖÁË"Ôà"Êý¾Ý¡£

ÔÚweb³ÌÐòÖоßÌåÊÇÔõÑù´¦ÀíÕâÖÖÀàËÆµÄÇé¿ö¡£
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20071022/7164f6e1/attachment.html 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年10月23日 星期二 00:14

@@ askfor在gmail.com
星期二 十月 23 00:14:32 HKT 2007

ÎҸоõÒ»°ãµÄweb³ÌÐò¶¼²»¿¼ÂÇÕâ¸ö¡£

On 10/22/07, leopay <leopay在gmail.com> wrote:
>
> ±È·½ËµÓû§´´½¨Ò»¸öÏà²áºó£¬ÔÊÐíÿ¸öÏà²á×î¶àÖ»ÄÜ´«5ÕÅÕÕÆ¬(ÕâÖ»ÊǸö¼ÙÉè)
>
> Óû§ÉÏ´«Ê±²¢·¢Ìá½»£¬ÔõÑù¿ØÖÆÕâ¸öÏà²áµÄÕÕÆ¬Êý²»³¬¹ý5.
>
> ¼ÙÉèÒѾ­ÉÏ´«ÁË4ÕÅͼƬÁË¡£
> È»ºó£¬
> A½ø³ÌÇëÇóÉÏ´«Ê±£¬´ÓÊý¾Ý¿âÀï¶ÁÈ¡Õâ¸öÏà²áÊý¾Ý£¬ÅжϿÉÒÔ½ÓÊÜÕâ´Î£¬Òò´Ë¿ªÊ¼ÉÏ´«¡£
> ÓÚ´Ëͬʱ£¬B½ø³ÌÒ²¿ªÊ¼ÉÏ´«ÇëÇó£¬Í¬ÑùÅжϿÉÒÔ½ÓÊÜÕâ´ÎÉÏ´«£¬¿ªÊ¼ÉÏ´«¡£
> ÕâÑù¾Íµ¼ÖÂÁË×îÖÕÕâ¸öÏà²áµÄÕÕÆ¬Êý´óÓÚÁË5.Ò²¾ÍÊdzöÏÖÁË"Ôà"Êý¾Ý¡£
>
> ÔÚweb³ÌÐòÖоßÌåÊÇÔõÑù´¦ÀíÕâÖÖÀàËÆµÄÇé¿ö¡£
>
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20071023/59ab4ab0/attachment.htm 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年10月23日 星期二 00:53

Cyril.Liu terry6394在gmail.com
星期二 十月 23 00:53:55 HKT 2007

是个有意思的问题,不知道Python有没有相关的事务类。感觉有一个比较笨的方法,就是你每次上传完之后再检查一下照片数量,如果查过了,会回滚。

On 10/23/07, @@ <askfor at gmail.com> wrote:
>
> 我感觉一般的web程序都不考虑这个。
>
> On 10/22/07, leopay <leopay at gmail.com> wrote:
>
> > 比方说用户创建一个相册后,允许每个相册最多只能传5张照片(这只是个假设)
> >
> > 用户上传时并发提交,怎样控制这个相册的照片数不超过5.
> >
> > 假设已经上传了4张图片了。
> > 然后,
> > A进程请求上传时,从数据库里读取这个相册数据,判断可以接受这次,因此开始上传。
> > 于此同时,B进程也开始上传请求,同样判断可以接受这次上传,开始上传。
> > 这样就导致了最终这个相册的照片数大于了5.也就是出现了"脏"数据。
> >
> > 在web程序中具体是怎样处理这种类似的情况。
> >
> > _______________________________________________
> > python-chinese
> > Post: send python-chinese at lists.python.cn
> > Subscribe: send subscribe to python-chinese-request at lists.python.cn
> > Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
> > Detail Info: http://python.cn/mailman/listinfo/python-chinese
> >
>
>
> _______________________________________________
> python-chinese
> Post: send python-chinese at lists.python.cn
> Subscribe: send subscribe to python-chinese-request at lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://python.cn/pipermail/python-chinese/attachments/20071023/20a2b8b8/attachment-0001.html 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年10月23日 星期二 00:55

vicalloy zbirder在gmail.com
星期二 十月 23 00:55:59 HKT 2007

我也觉得不必考虑这个。

在 07-10-23,@@<askfor在gmail.com> 写道:
> 我感觉一般的web程序都不考虑这个。

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

如下红色区域有误,请重新填写。

    你的回复:

    请 登录 后回复。还没有在Zeuux哲思注册吗?现在 注册 !

    Zeuux © 2025

    京ICP备05028076号