[Django] #30707: why it took 30s when call sorted function in django server sometimes

4 views
Skip to first unread message

Django

unread,
Aug 13, 2019, 10:32:02 PM8/13/19
to django-...@googlegroups.com
#30707: why it took 30s when call sorted function in django server sometimes
-------------------------------------+-------------------------------------
Reporter: liumilan | Owner: nobody
Type: Bug | Status: new
Component: Testing | Version: 2.2
framework |
Severity: Normal | Keywords: sorted function
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
I add some logic in django . And when i sent requests to server,i found
some requests are handled so slowly,and then find it will take much time
when call sorted function.But it is stranged that if i sent this wired
data to server alone,it is ok,only take 100ms.Does the sorted function has
confict with django?


{{{
def recall(word):
dict_result = {}
word_fields = word.split(":")
for i in range(0,len(word_fields)):
generate(dict_resut)
pre_result = sorted(dict_result.items(),
key=operator.itemgetter(1),reverse=True)

return recall_tag[:-1]

client code is:
for line in sys.stdin:
line = line.rstrip('\n')
fields = line.split("\t")
id = fields[0]
title = fields[1]
page_params_mq = {'id':vid,'title':title}
try :
rec_mq_res = get_rec(server_ip_mq, server_port_mq,
web_page_mq, page_params_mq)
except:
print (line)
}}}
I run
cat test_data|python client.py
if there is only one data in test_data file,it is ok.If there are many
data,it will occur randomly slowly

--
Ticket URL: <https://code.djangoproject.com/ticket/30707>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Aug 14, 2019, 1:26:21 AM8/14/19
to django-...@googlegroups.com
#30707: why it took 30s when call sorted function in django server sometimes.
---------------------------------+--------------------------------------
Reporter: liumilan | Owner: nobody
Type: Bug | Status: closed
Component: Core (Other) | Version: master
Severity: Normal | Resolution: invalid
Keywords: sorted function | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------
Changes (by felixxm):

* status: new => closed
* resolution: => invalid
* version: 2.2 => master
* component: Testing framework => Core (Other)


Comment:

I don't see anything Django-specific in attached example. It is rather a
question about how `sorted()` works on iterables in Python.

Closing per TicketClosingReasons/UseSupportChannels.

--
Ticket URL: <https://code.djangoproject.com/ticket/30707#comment:1>

Reply all
Reply to author
Forward
0 new messages