Changeset View
Changeset View
Standalone View
Standalone View
swh/scheduler/updater/backend.py
Show All 34 Lines | def __init__(self, db, cache_read_limit=1000, | ||||
self._db = None | self._db = None | ||||
self.limit = cache_read_limit | self.limit = cache_read_limit | ||||
def get_db(self): | def get_db(self): | ||||
if self._db: | if self._db: | ||||
return self._db | return self._db | ||||
return BaseDb.from_pool(self._pool) | return BaseDb.from_pool(self._pool) | ||||
def put_db(self, db): | |||||
if db is not self._db: | |||||
db.put_conn() | |||||
cache_put_keys = ['url', 'cnt', 'last_seen', 'origin_type'] | cache_put_keys = ['url', 'cnt', 'last_seen', 'origin_type'] | ||||
@db_transaction() | @db_transaction() | ||||
def cache_put(self, events, timestamp=None, db=None, cur=None): | def cache_put(self, events, timestamp=None, db=None, cur=None): | ||||
"""Write new events in the backend. | """Write new events in the backend. | ||||
""" | """ | ||||
cur.execute('select swh_mktemp_cache()') | cur.execute('select swh_mktemp_cache()') | ||||
▲ Show 20 Lines • Show All 59 Lines • Show Last 20 Lines |