kopia lustrzana https://github.com/snarfed/bridgy-fed
add thread name to log message prefix to trace across Protocol.deliver threads
rodzic
5bf081afdb
commit
f002b536d9
|
@ -21,6 +21,11 @@ logger = logging.getLogger(__name__)
|
|||
# logging.getLogger('lexrpc').setLevel(logging.INFO)
|
||||
logging.getLogger('negotiator').setLevel(logging.WARNING)
|
||||
|
||||
# add thread name to log prefix so we can trace log messages in
|
||||
# Protocol.deliver, which is parallelized across threads
|
||||
logging.getLogger().handlers[0].setFormatter(
|
||||
logging.Formatter(fmt='%(levelname)s:%(name)s:%(threadName)s:%(message)s'))
|
||||
|
||||
app_dir = Path(__file__).parent
|
||||
|
||||
|
||||
|
|
|
@ -824,7 +824,8 @@ class Protocol:
|
|||
errors = [] # stores (target URL, code, body) tuples
|
||||
|
||||
# deliver to all targets, in parallel, with a thread pool
|
||||
with ThreadPoolExecutor(max_workers=DELIVER_THREADS) as executor:
|
||||
with ThreadPoolExecutor(max_workers=DELIVER_THREADS,
|
||||
thread_name_prefix='deliver') as executor:
|
||||
results = []
|
||||
|
||||
for target, orig_obj in sorted_targets:
|
||||
|
|
Ładowanie…
Reference in New Issue