Mercurial > p > roundup > code
diff roundup/backends/indexer_common.py @ 4017:605f4a7910b4
Small performance-improvement and bug-fix for indexer:
In rare cases find will return duplicate ids. The previous check that
re-initialized the value would never match (id at that point was python's
built-in function id). It's faster to not re-process an id when it has
been seen.
| author | Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net> |
|---|---|
| date | Thu, 11 Sep 2008 19:41:07 +0000 |
| parents | 20c9a1cefb39 |
| children | eddb82d0964c |
line wrap: on
line diff
--- a/roundup/backends/indexer_common.py Thu Sep 11 19:10:30 2008 +0000 +++ b/roundup/backends/indexer_common.py Thu Sep 11 19:41:07 2008 +0000 @@ -1,4 +1,4 @@ -#$Id: indexer_common.py,v 1.10 2008-08-18 07:03:44 richard Exp $ +#$Id: indexer_common.py,v 1.11 2008-09-11 19:41:07 schlatterbeck Exp $ import re, sets from roundup import hyperdb @@ -86,8 +86,9 @@ propdefs = klass.getprops() for resid in klass.find(**propspec): resid = str(resid) - if not nodeids.has_key(id): - nodeids[resid] = {} + if resid in nodeids: + continue # we ignore duplicate resids + nodeids[resid] = {} node_dict = nodeids[resid] # now figure out where it came from for linkprop in propspec.keys():
