You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by jo...@apache.org on 2012/12/07 18:50:31 UTC
[2/2] git commit: [#4691] Flush after computing LCD for each commit
[#4691] Flush after computing LCD for each commit
Signed-off-by: Cory Johns <jo...@geek.net>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/435800a2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/435800a2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/435800a2
Branch: refs/heads/cj/4691
Commit: 435800a2fa394004633851610745838fa4132f1e
Parents: 6de80ff
Author: Cory Johns <jo...@geek.net>
Authored: Fri Dec 7 17:27:52 2012 +0000
Committer: Cory Johns <jo...@geek.net>
Committed: Fri Dec 7 17:49:42 2012 +0000
----------------------------------------------------------------------
Allura/allura/model/repo.py | 2 +-
Allura/allura/model/repo_refresh.py | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/435800a2/Allura/allura/model/repo.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repo.py b/Allura/allura/model/repo.py
index aefc1fa..b9aaad0 100644
--- a/Allura/allura/model/repo.py
+++ b/Allura/allura/model/repo.py
@@ -885,7 +885,7 @@ class ModelCache(object):
self._cache[cls][key] = val
elif len(self._cache[cls]) >= self.max_size:
# remove the least-recently-used cache item
- instance = self._cache[cls].popitem(last=False)
+ key, instance = self._cache[cls].popitem(last=False)
session(instance).expunge(instance)
def size(self):
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/435800a2/Allura/allura/model/repo_refresh.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repo_refresh.py b/Allura/allura/model/repo_refresh.py
index ea0154b..36ca927 100644
--- a/Allura/allura/model/repo_refresh.py
+++ b/Allura/allura/model/repo_refresh.py
@@ -11,7 +11,7 @@ import tg
from pylons import g,c
from ming.base import Object
-from ming.orm import mapper, session
+from ming.orm import mapper, session, ThreadLocalORMSession
from allura.lib import utils
from allura.lib import helpers as h
@@ -104,6 +104,7 @@ def refresh_repo(repo, all_commits=False, notify=True):
for i, oid in enumerate(reversed(commit_ids)):
ci = cache.get(Commit, dict(_id=oid))
compute_lcds(ci, cache)
+ ThreadLocalORMSession.flush_all()
if (i+1) % 100 == 0:
log.info('Compute last commit info %d: %s', (i+1), ci._id)