Thanks for the information! Using celery was my first idea too, but here it is not practical as I'll be transferring sensitive information through the socket and I'd rather avoid having hanging around in the Celery queue.
So I guess opening the socket from inside the view code and then closing it would be OK? Le 11 mai 2012 11:17, "Marcin Tustin" <marcin.tus...@gmail.com> a écrit : > I use a celery task to make this sort of job asynchronous. The task makes > a new connection to the "remote" (same server) service each time. This > proves to be sufficiently fast. > > If you are making a lot of requests, the overhead of making new > connections may prove to be significant. I wouldn't anticipate this unless > you are making a new request more frequently than perhaps once a second > (and even then, I would wait and see what performance was like). > > On Fri, May 11, 2012 at 9:50 AM, Thomas Orozco > <g.orozco.tho...@gmail.com>wrote: > >> Hi, >> >> Here's my situation: one of my views needs to call an external service >> (through a socket ; actually the said service is on the same server). >> >> I don't even need to know about the service's response as I'll inquire >> about it asynchronously in an effort to avoid delay on the user's end. >> >> What are the best practices here ? >> Should I open a socket connection each time I want to access the service? >> Should I keep one open all the time in a separate thread? >> >> Thanks in advance, >> >> Thomas >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To post to this group, send email to django-users@googlegroups.com. >> To unsubscribe from this group, send email to >> django-users+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/django-users?hl=en. >> > > > > -- > Marcin Tustin > Tel: 07773 787 105 > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.