Merge pull request #2720 from lbryio/loggly-database-error

fix database error caused by logging tracebacks from within the sqlite transaction runner
This commit is contained in:
Jack Robison 2020-01-12 16:23:26 -05:00 committed by GitHub
commit 1a0d805bad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View file

@ -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()

View file

@ -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: