Skip to content

Commit

Permalink
data cacher: deletes cache before refilling it
Browse files Browse the repository at this point in the history
* Deletes data cacher's cache before refilling it.  This is useful
  especially for citation dictionaries.

* Removes `touch` work wround from bibrank citation indexer that is not
  needed anymore.
  • Loading branch information
Osso authored and tiborsimko committed Jun 15, 2012
1 parent 12dfdc6 commit 23a3ba0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
12 changes: 0 additions & 12 deletions modules/bibrank/lib/bibrank_tag_based_indexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,18 +232,6 @@ def intoDB(dict, date, rank_method_code):
if date:
run_sql("UPDATE rnkMETHOD SET last_updated=%s WHERE name=%s", (date, rank_method_code))

# FIXME: the following is a workaround for the citation indexer
# memory troubles, when Apache WSGI daemon processes may end up
# doubling the memory after citation dictionary is updated;
# therefore let us restart the WSGI daemon application after the
# citation indexer finished, which relieves this problem. The
# restart is done via touching invenio.wsgi file. The proper fix
# for this problem would be strict separation between citation
# indexer updating dicts and citation searcher loading dicts.
if rank_method_code == 'citation':
os.system('touch ' + os.path.join(CFG_PREFIX, 'var', 'www-wsgi',
'invenio.wsgi'))

def fromDB(rank_method_code):
"""Get the data for a rank method"""
id = run_sql("SELECT id from rnkMETHOD where name=%s", (rank_method_code, ))
Expand Down
4 changes: 4 additions & 0 deletions modules/miscutil/lib/data_cacher.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ def create_cache(self):
Create and populate cache by calling cache filler. Called on
startup and used later during runtime as needed by clients.
"""
# We empty the cache first to force freeing of the variable
# this is useful when it is really big like our citations dictionary
self.cache = None

self.cache = self.cache_filler()
self.timestamp = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())

Expand Down

0 comments on commit 23a3ba0

Please sign in to comment.