From 646ae7e2d177efea5a26970733f32dc1848970ae Mon Sep 17 00:00:00 2001 From: Jack Robison Date: Sun, 12 Jan 2020 16:11:44 -0500 Subject: [PATCH 1/2] catch RuntimeError in loggly handler to handle cases where there is not an event loop --- lbry/extras/daemon/loggly_handler.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lbry/extras/daemon/loggly_handler.py b/lbry/extras/daemon/loggly_handler.py index 4e5888d52..f69c245ef 100644 --- a/lbry/extras/daemon/loggly_handler.py +++ b/lbry/extras/daemon/loggly_handler.py @@ -68,7 +68,11 @@ class HTTPSLogglyHandler(logging.Handler): return await self._emit(record, retry=False) def emit(self, record): - asyncio.ensure_future(self._emit(record)) + try: + asyncio.ensure_future(self._emit(record), loop=self._loop) + except RuntimeError: # TODO: use a second loop + print(f"\nfailed to send traceback to loggly, please file an issue with the following traceback:\n" + f"{self.format(record)}") def close(self): super().close() From 1a802469f584fb39b6d7c16e48e2d857637db7c7 Mon Sep 17 00:00:00 2001 From: Jack Robison Date: Sun, 12 Jan 2020 16:11:57 -0500 Subject: [PATCH 2/2] missing fetchall() --- lbry/wallet/database.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lbry/wallet/database.py b/lbry/wallet/database.py index eec048a2d..738ecba72 100644 --- a/lbry/wallet/database.py +++ b/lbry/wallet/database.py @@ -417,7 +417,7 @@ class Database(SQLiteMixin): }, 'txid = ?', (tx.id,))) def _transaction_io(self, conn: sqlite3.Connection, tx: Transaction, address, txhash): - conn.execute(*self._insert_sql('tx', self.tx_to_row(tx), replace=True)) + conn.execute(*self._insert_sql('tx', self.tx_to_row(tx), replace=True)).fetchall() for txo in tx.outputs: if txo.script.is_pay_pubkey_hash and txo.pubkey_hash == txhash: