This commit is contained in:
David Baker 2018-04-17 10:34:04 +01:00
parent 7285afa4be
commit 8743f42b49
3 changed files with 7 additions and 5 deletions

View file

@ -83,7 +83,7 @@ class ProfileHandler(BaseHandler):
try: try:
for i in xrange(host_batches[repl_host] + 1, latest_batch + 1): for i in xrange(host_batches[repl_host] + 1, latest_batch + 1):
yield self._replicate_host_profile_batch(repl_host, i) yield self._replicate_host_profile_batch(repl_host, i)
except: except Exception:
logger.exception( logger.exception(
"Exception while replicating to %s: aborting for now", repl_host, "Exception while replicating to %s: aborting for now", repl_host,
) )
@ -110,7 +110,7 @@ class ProfileHandler(BaseHandler):
yield self.http_client.post_json_get_json(url, signed_body) yield self.http_client.post_json_get_json(url, signed_body)
self.store.update_replication_batch_for_host(host, batchnum) self.store.update_replication_batch_for_host(host, batchnum)
logger.info("Sucessfully replicated profile batch %d to %s", batchnum, host) logger.info("Sucessfully replicated profile batch %d to %s", batchnum, host)
except: except Exception:
# This will get retried when the looping call next comes around # This will get retried when the looping call next comes around
logger.exception("Failed to replicate profile batch %d to %s", batchnum, host) logger.exception("Failed to replicate profile batch %d to %s", batchnum, host)
raise raise

View file

@ -71,7 +71,9 @@ class ProfileWorkerStore(SQLBaseStore):
txn.execute("SELECT MAX(batch) as maxbatch FROM profiles") txn.execute("SELECT MAX(batch) as maxbatch FROM profiles")
rows = self.cursor_to_dict(txn) rows = self.cursor_to_dict(txn)
return rows[0]['maxbatch'] return rows[0]['maxbatch']
max_batch = yield self.runInteraction("get_latest_profile_replication_batch_number", f) max_batch = yield self.runInteraction(
"get_latest_profile_replication_batch_number", f,
)
defer.returnValue(max_batch) defer.returnValue(max_batch)
def get_profile_batch(self, batchnum): def get_profile_batch(self, batchnum):