OLD | NEW |
(Empty) | |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is govered by a BSD-style |
| 3 # license that can be found in the LICENSE file or at |
| 4 # https://developers.google.com/open-source/licenses/bsd |
| 5 |
| 6 """Implementation of the filter rules feature.""" |
| 7 |
| 8 import logging |
| 9 |
| 10 from features import filterrules_helpers |
| 11 from framework import jsonfeed |
| 12 from tracker import tracker_constants |
| 13 |
| 14 |
| 15 class RecomputeDerivedFieldsTask(jsonfeed.InternalTask): |
| 16 """JSON servlet that recomputes derived fields on a batch of issues.""" |
| 17 |
| 18 def HandleRequest(self, mr): |
| 19 """Recompute derived field values on one range of issues in a shard.""" |
| 20 logging.info( |
| 21 'params are %r %r %r %r', mr.specified_project_id, mr.lower_bound, |
| 22 mr.upper_bound, mr.shard_id) |
| 23 project = self.services.project.GetProject( |
| 24 mr.cnxn, mr.specified_project_id) |
| 25 config = self.services.config.GetProjectConfig( |
| 26 mr.cnxn, mr.specified_project_id) |
| 27 filterrules_helpers.RecomputeAllDerivedFieldsNow( |
| 28 mr.cnxn, self.services, project, config, lower_bound=mr.lower_bound, |
| 29 upper_bound=mr.upper_bound, shard_id=mr.shard_id) |
| 30 |
| 31 return { |
| 32 'success': True, |
| 33 } |
| 34 |
| 35 |
| 36 class ReindexQueueCron(jsonfeed.InternalTask): |
| 37 """JSON servlet that reindexes some issues each minute, as needed.""" |
| 38 |
| 39 def HandleRequest(self, mr): |
| 40 """Reindex issues that are listed in the the reindex table.""" |
| 41 num_reindexed = self.services.issue.ReindexIssues( |
| 42 mr.cnxn, tracker_constants.MAX_ISSUES_TO_REINDEX_PER_MINUTE, |
| 43 self.services.user) |
| 44 |
| 45 return { |
| 46 'num_reindexed': num_reindexed, |
| 47 } |
OLD | NEW |