allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject allura git commit: [#8178] Configurable bin count invalidation delay; adds missing calls to invalidate_bin_counts
Date Wed, 24 Jan 2018 22:50:13 GMT
Repository: allura
Updated Branches:
  refs/heads/master 2c11a9278 -> f554f783f


[#8178] Configurable bin count invalidation delay; adds missing calls to invalidate_bin_counts


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/f554f783
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/f554f783
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/f554f783

Branch: refs/heads/master
Commit: f554f783fec008bee6936082f72dbca1ef6dad08
Parents: 2c11a92
Author: Kenton Taylor <ktaylor@slashdotmedia.com>
Authored: Tue Jan 23 19:17:19 2018 +0000
Committer: Dave Brondsema <dave@brondsema.net>
Committed: Wed Jan 24 17:49:58 2018 -0500

----------------------------------------------------------------------
 Allura/development.ini                    | 2 ++
 ForgeTracker/forgetracker/model/ticket.py | 5 +++--
 ForgeTracker/forgetracker/tracker_main.py | 8 +++++---
 3 files changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/f554f783/Allura/development.ini
----------------------------------------------------------------------
diff --git a/Allura/development.ini b/Allura/development.ini
index 47fee90..cd5404e 100644
--- a/Allura/development.ini
+++ b/Allura/development.ini
@@ -589,6 +589,8 @@ short_url.url_pattern = {base_url}/{nbhd}/{project}/{mount_point}/{short_name}
 ;
 userstats.count_lines_of_code = true
 
+; to avoid race condition, this needs to be a bit longer than the SOLR commitWithin delay.
+; forgetracker.bin_invalidate_delay = 5
 
 ;
 ; Optional settings for profiling with https://pypi.python.org/pypi/keas.profile

http://git-wip-us.apache.org/repos/asf/allura/blob/f554f783/ForgeTracker/forgetracker/model/ticket.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/model/ticket.py b/ForgeTracker/forgetracker/model/ticket.py
index 8f64ed1..a3ec9dc 100644
--- a/ForgeTracker/forgetracker/model/ticket.py
+++ b/ForgeTracker/forgetracker/model/ticket.py
@@ -239,13 +239,14 @@ class Globals(MappedClass):
         # the task clears it when it's done.  However, in the off chance
         # that the task fails or is interrupted, we ignore the flag if it's
         # older than 5 minutes.
-        invalidation_expiry = datetime.utcnow() - timedelta(minutes=5)
+        delay = int(tg_config.get('forgetracker.bin_invalidate_delay', 5))
+        invalidation_expiry = datetime.utcnow() - timedelta(minutes=delay)
         if self._bin_counts_invalidated is not None and \
            self._bin_counts_invalidated > invalidation_expiry:
             return
         self._bin_counts_invalidated = datetime.utcnow()
         from forgetracker import tasks  # prevent circular import
-        tasks.update_bin_counts.post(self.app_config_id, delay=5)
+        tasks.update_bin_counts.post(self.app_config_id, delay=delay)
 
     def sortable_custom_fields_shown_in_search(self):
         def solr_type(field_name):

http://git-wip-us.apache.org/repos/asf/allura/blob/f554f783/ForgeTracker/forgetracker/tracker_main.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/tracker_main.py b/ForgeTracker/forgetracker/tracker_main.py
index a924cc9..1f9822b 100644
--- a/ForgeTracker/forgetracker/tracker_main.py
+++ b/ForgeTracker/forgetracker/tracker_main.py
@@ -726,7 +726,7 @@ class RootController(BaseController, FeedController):
         if not isinstance(filter, dict):
             # JsonConverter above can return an int, string, etc, if users give bad inputs,
but it needs to be a dict
             filter = {}
-            
+
         # it's just our original query mangled and sent back to us
         kw.pop('q', None)
         result = TM.Ticket.paged_query_or_search(c.app.config, c.user,
@@ -829,7 +829,7 @@ class RootController(BaseController, FeedController):
     def search(self, q=None, query=None, project=None, columns=None, page=0, sort=None,
                deleted=False, filter=None, **kw):
         require(has_access(c.app, 'read'))
-   
+
         if deleted and not has_access(c.app, 'delete'):
             deleted = False
         if query and not q:
@@ -1458,6 +1458,7 @@ class TicketController(BaseController, FeedController):
             dt=datetime.utcnow())
         self.ticket.summary += suffix
         flash('Ticket successfully deleted')
+        c.app.globals.invalidate_bin_counts()
         return dict(location='../' + str(self.ticket.ticket_num))
 
     @without_trailing_slash
@@ -1470,6 +1471,7 @@ class TicketController(BaseController, FeedController):
             ' \d+:\d+:\d+ \d+-\d+-\d+$', '', self.ticket.summary)
         M.Shortlink.from_artifact(self.ticket)
         flash('Ticket successfully restored')
+        c.app.globals.invalidate_bin_counts()
         return dict(location='../' + str(self.ticket.ticket_num))
 
     @require_post()
@@ -1950,7 +1952,7 @@ class MilestoneController(BaseController):
             show_deleted = [False, True]
         elif deleted and not has_access(c.app, 'delete'):
             deleted = False
-            
+
         result = TM.Ticket.paged_query_or_search(c.app.config, c.user,
                                                  self.mongo_query,
                                                  self.solr_query,


Mime
View raw message