##// END OF EJS Templates
added recursion limit for stats gathering, sometimes it did >1000 loops which lead to python throwing max recursion depth exceeded error....
marcink -
r3276:eaa887c6 beta
parent child Browse files
Show More
@@ -140,7 +140,9 b' class SummaryController(BaseRepoControll'
140 if dbrepo.enable_statistics:
140 if dbrepo.enable_statistics:
141 c.show_stats = True
141 c.show_stats = True
142 c.no_data_msg = _('No data loaded yet')
142 c.no_data_msg = _('No data loaded yet')
143 run_task(get_commits_stats, c.dbrepo.repo_name, ts_min_y, ts_max_y)
143 recurse_limit = 500 # don't recurse more than 500 times when parsing
144 run_task(get_commits_stats, c.dbrepo.repo_name, ts_min_y,
145 ts_max_y, recurse_limit)
144 else:
146 else:
145 c.show_stats = False
147 c.show_stats = False
146 c.no_data_msg = _('Statistics are disabled for this repository')
148 c.no_data_msg = _('Statistics are disabled for this repository')
@@ -87,7 +87,7 b' def whoosh_index(repo_location, full_ind'
87
87
88 @task(ignore_result=True)
88 @task(ignore_result=True)
89 @dbsession
89 @dbsession
90 def get_commits_stats(repo_name, ts_min_y, ts_max_y):
90 def get_commits_stats(repo_name, ts_min_y, ts_max_y, recurse_limit=100):
91 log = get_logger(get_commits_stats)
91 log = get_logger(get_commits_stats)
92 DBS = get_session()
92 DBS = get_session()
93 lockkey = __get_lockkey('get_commits_stats', repo_name, ts_min_y,
93 lockkey = __get_lockkey('get_commits_stats', repo_name, ts_min_y,
@@ -240,8 +240,12 b' def get_commits_stats(repo_name, ts_min_'
240 lock.release()
240 lock.release()
241
241
242 # execute another task if celery is enabled
242 # execute another task if celery is enabled
243 if len(repo.revisions) > 1 and CELERY_ON:
243 if len(repo.revisions) > 1 and CELERY_ON and recurse_limit > 0:
244 run_task(get_commits_stats, repo_name, ts_min_y, ts_max_y)
244 recurse_limit -= 1
245 run_task(get_commits_stats, repo_name, ts_min_y, ts_max_y,
246 recurse_limit)
247 if recurse_limit <= 0:
248 log.debug('Breaking recursive mode due to reach of recurse limit')
245 return True
249 return True
246 except LockHeld:
250 except LockHeld:
247 log.info('LockHeld')
251 log.info('LockHeld')
General Comments 0
You need to be logged in to leave comments. Login now