Skip to content
This repository has been archived by the owner on Mar 15, 2018. It is now read-only.

Commit

Permalink
Timeouts
Browse files Browse the repository at this point in the history
  • Loading branch information
davedash authored and jbalogh committed Apr 1, 2010
1 parent bca02cb commit 81e0a3b
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion apps/search/client.py
@@ -1,4 +1,6 @@
import re
import socket
import logging

from django.conf import settings
from django.utils import translation
Expand All @@ -13,6 +15,8 @@
m_dot_n_re = re.compile(r'^\d+\.\d+$')
SEARCH_ENGINE_APP = 99

log = logging.getLogger('z.sphinx')


def get_category_id(category, application):
"""
Expand Down Expand Up @@ -222,7 +226,16 @@ def query(self, term, limit=10, offset=0, **kwargs):
# * Num apps filter
# * Logging

result = sc.Query(term)
try:
result = sc.Query(term)
except socket.timeout:
log.error("Query has timed out.")
import pdb; pdb.set_trace()
raise SearchError("Query has timed out.")
except Exception, e:
log.error("Sphinx threw an unknown exception: %s" % e)
raise SearchError("Sphinx threw an unknown exception.")

self.total_found = result['total_found'] if result else 0

if sc.GetLastError():
Expand Down

0 comments on commit 81e0a3b

Please sign in to comment.