Commit 9722d241 authored by Julien Muchembled's avatar Julien Muchembled

debug: add snippet to ask a storage to commit

parent a6edf36b
...@@ -146,7 +146,7 @@ elif IF == 'profile': ...@@ -146,7 +146,7 @@ elif IF == 'profile':
prof.disable() prof.disable()
prof.dump_stats(path) prof.dump_stats(path)
@defer @defer
def profile(app): def _(app):
import cProfile, threading import cProfile, threading
path = profile_path(app) path = profile_path(app)
prof = cProfile.Profile() prof = cProfile.Profile()
...@@ -220,7 +220,7 @@ elif IF == 'trace-cache': ...@@ -220,7 +220,7 @@ elif IF == 'trace-cache':
self._cache.invalidate(oid, tid) self._cache.invalidate(oid, tid)
@defer @defer
def profile(app): def _(app):
with app._cache_lock: with app._cache_lock:
cache = app._cache cache = app._cache
if type(cache) is ClientCache: if type(cache) is ClientCache:
...@@ -229,3 +229,14 @@ elif IF == 'trace-cache': ...@@ -229,3 +229,14 @@ elif IF == 'trace-cache':
app._cache.clear() app._cache.clear()
else: else:
app._cache = cache.close() app._cache = cache.close()
elif IF == 'commit':
@defer
def _(app):
try:
dm = app.dm
except AttributeError:
return
if dm is not None:
with dm.lock:
dm.commit()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment