Opened 6 years ago
Closed 6 years ago
#30707 closed Bug (invalid)
why it took 30s when call sorted function in django server sometimes.
| Reported by: | liumilan | Owned by: | nobody |
|---|---|---|---|
| Component: | Core (Other) | Version: | dev |
| Severity: | Normal | Keywords: | sorted function |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
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
Change History (1)
comment:1 by , 6 years ago
| Component: | Testing framework → Core (Other) |
|---|---|
| Resolution: | → invalid |
| Status: | new → closed |
| Summary: | why it took 30s when call sorted function in django server sometimes → why it took 30s when call sorted function in django server sometimes. |
| Version: | 2.2 → master |
Note:
See TracTickets
for help on using tickets.
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.