Opened 9 years ago

Last modified 3 years ago

#5958 new enhancement

GeoTicketPlugin should cache unlocatable results

Reported by: Jeff Hammel Owned by:
Priority: high Component: GeoTicketPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.11


locate_ticket is currently quite slow on the /query screen if there are tickets with unlocatable locations. This is because these locations are not cached:

    def locate_ticket(self, ticket):
            results = get_all_dict(self.env, "select latitude, longitude from ticket_location where ticket='%s'" %
            if results:
                return ticket['location'], (results[0]['latitude'], results[0]['longitude'])

        if ticket['location'] is None or not ticket['location'].strip():
            raise GeolocationException

        # XXX blindly assume UTF-8
            location = ticket['location'].encode('utf-8')
        except UnicodeEncodeError:

        location, (lat, lon) = self.geolocate(location)
            self.set_location(, lat, lon)
        return location, (lat, lon)

A set of unlocatable locations should be hashed on the instance so that additional requests need not be made for bad locations (or more precisely, they need not be made more than once per instance).

Attachments (0)

Change History (3)

comment:1 Changed 9 years ago by Jeff Hammel

Status: newassigned

comment:2 Changed 9 years ago by Jeff Hammel

Status: assignednew

comment:3 Changed 3 years ago by Ryan J Ollos

Owner: Jeff Hammel deleted

Modify Ticket

Change Properties
Set your email in Preferences
as new The ticket will remain with no owner.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.