Latency for API call to a Python Function
shazianusra at gmail.com
shazianusra at gmail.com
Tue Aug 29 11:22:48 EDT 2017
Hi,
I have an issue with one piece of code in Python that when my API using Nginx/Uwsgi/EC2 AWS calls this function it causes latency. I need help to figure out if there is I am doing something wrong with this particular function. Rest of the code calls for DB are working fine and no issues. But only this piece of code is causing latency.
def getvideos(self, listitem):
channelId = ""
returnVideos,dictData = {},{}
mode = 0
channelId = listitem[KEY_CHANNELID]
if KEY_CHANNELMODE in listitem :
mode = int(listitem[KEY_CHANNELMODE])
filteredVideos = []
if mode == 0:
filteredVideos = self.getFilteredVideos(listitem)
if mode == 1:
filteredVideos = self.getFocus(listitem)
if mode == 2:
filteredVideos = self.getFavourites(listitem)
newFilteredVideos = []
print "Returning videos : ",filteredVideos
if filteredVideos == None or len(filteredVideos) == 0:
print "\n\n\n\tWe are returning NO filteredVideos !"
#filteredVideos = list(set(filteredVideos))
dictData[KEY_SERVICE] = SERVICE_GETVIDEOS
dictData[KEY_CHANNELID] = str(channelId)
if len(filteredVideos) > 0 :
dictData[KEY_VIDEOS] = self.returnVideos(filteredVideos)
else :
dictData[KEY_VIDEOS] = {}
dictData[KEY_VIDEOS][KEY_STATUS] = 'No Videos'
returnVideos[TAG_IRON] = dictData
return json.dumps(returnVideos)
Looking forward,
Regards,
Shazia
More information about the Python-list
mailing list