Modify

Opened 5 years ago

Last modified 5 years ago

#5958 new enhancement

GeoTicketPlugin should cache unlocatable results

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

Description

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):
        if ticket.id:
            results = get_all_dict(self.env, "select latitude, longitude from ticket_location where ticket='%s'" % ticket.id)
            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
        try:
            location = ticket['location'].encode('utf-8')
        except UnicodeEncodeError:
            raise

        location, (lat, lon) = self.geolocate(location)
        if ticket.id:
            self.set_location(ticket.id, 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 (2)

comment:1 Changed 5 years ago by k0s

  • Status changed from new to assigned

comment:2 Changed 5 years ago by k0s

  • Status changed from assigned to new

Add Comment

Modify Ticket

Action
as new The owner will remain k0s.
Author


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

 
Note: See TracTickets for help on using tickets.