Edgewall Software

Ticket #6436: cache-get_ticket_fields-r6792.diff

File cache-get_ticket_fields-r6792.diff, 1.0 kB (added by cboos, 5 months ago)

Seems like the Query.from_string is to blame, and the fact that this triggers the creation of a Query object which calls TicketSystem.get_ticket_fields().

  • trac/ticket/api.py

     
    177177 
    178178    def get_ticket_fields(self): 
    179179        """Returns the list of fields available for tickets.""" 
     180        # This is now cached - as it makes quite a number of things faster, 
     181        # e.g. #6436 
     182        if self._fields is None: 
     183            self._fields = self._get_ticket_fields() 
     184        return self._fields 
     185 
     186    _fields = None 
     187    def _get_ticket_fields(self): 
    180188        from trac.ticket import model 
    181189 
    182190        db = self.env.get_db_cnx() 
     
    248256        return fields 
    249257 
    250258    def get_custom_fields(self): 
     259        if self._custom_fields is None: 
     260            self._custom_fields = self._get_custom_fields() 
     261        return self._custom_fields 
     262 
     263    _custom_fields = None 
     264    def _get_custom_fields(self): 
    251265        fields = [] 
    252266        config = self.config['ticket-custom'] 
    253267        for name in [option for option, value in config.options()