Object copy needs to be inline

merge-requests/30/head
Bob Mottram 2022-04-03 13:43:20 +01:00
parent 0fddc2204d
commit e2bc95c9db
3 changed files with 8 additions and 14 deletions

View File

@ -1633,10 +1633,9 @@ class PubServer(BaseHTTPRequestHandler):
account_outbox_thread_name + '/' + account_outbox_thread_name + '/' +
str(self.server.outbox_thread_index[account_outbox_thread_name])) str(self.server.outbox_thread_index[account_outbox_thread_name]))
print('THREAD: _post_to_outbox') print('THREAD: _post_to_outbox')
message_json_copy = message_json.copy()
self.server.outboxThread[account_outbox_thread_name][index] = \ self.server.outboxThread[account_outbox_thread_name][index] = \
thread_with_trace(target=self._post_to_outbox, thread_with_trace(target=self._post_to_outbox,
args=(message_json_copy, args=(message_json.copy(),
self.server.project_version, None, self.server.project_version, None,
curr_session, proxy_type), curr_session, proxy_type),
daemon=True) daemon=True)

View File

@ -2495,16 +2495,14 @@ def send_post(signing_priv_key_pem: str, project_version: str,
send_threads.pop(0) send_threads.pop(0)
print('WARN: thread killed') print('WARN: thread killed')
print('THREAD: thread_send_post') print('THREAD: thread_send_post')
signature_header_json_copy = signature_header_json.copy()
signature_header_json_ld_copy = signature_header_json_ld.copy()
thr = \ thr = \
thread_with_trace(target=thread_send_post, thread_with_trace(target=thread_send_post,
args=(session, args=(session,
post_json_str, post_json_str,
federation_list, federation_list,
inbox_url, base_dir, inbox_url, base_dir,
signature_header_json_copy, signature_header_json.copy(),
signature_header_json_ld_copy, signature_header_json_ld.copy(),
post_log, debug, http_prefix, post_log, debug, http_prefix,
domain_full), daemon=True) domain_full), daemon=True)
send_threads.append(thr) send_threads.append(thr)
@ -2907,16 +2905,14 @@ def send_signed_json(post_json_object: {}, session, base_dir: str,
pprint(post_json_object) pprint(post_json_object)
domain_full = get_full_domain(domain, port) domain_full = get_full_domain(domain, port)
print('THREAD: thread_send_post 2') print('THREAD: thread_send_post 2')
signature_header_json_copy = signature_header_json.copy(),
signature_header_json_ld_copy = signature_header_json_ld.copy(),
thr = \ thr = \
thread_with_trace(target=thread_send_post, thread_with_trace(target=thread_send_post,
args=(session, args=(session,
post_json_str, post_json_str,
federation_list, federation_list,
inbox_url, base_dir, inbox_url, base_dir,
signature_header_json_copy, signature_header_json.copy(),
signature_header_json_ld_copy, signature_header_json_ld.copy(),
post_log, debug, post_log, debug,
http_prefix, domain_full), daemon=True) http_prefix, domain_full), daemon=True)
send_threads.append(thr) send_threads.append(thr)
@ -3492,7 +3488,6 @@ def send_to_followers_thread(server, session, session_onion, session_i2p,
"""Returns a thread used to send a post to followers """Returns a thread used to send a post to followers
""" """
print('THREAD: send_to_followers') print('THREAD: send_to_followers')
post_json_object_copy = post_json_object.copy()
send_thread = \ send_thread = \
thread_with_trace(target=send_to_followers, thread_with_trace(target=send_to_followers,
args=(server, session, session_onion, session_i2p, args=(server, session, session_onion, session_i2p,
@ -3501,7 +3496,7 @@ def send_to_followers_thread(server, session, session_onion, session_i2p,
http_prefix, federation_list, http_prefix, federation_list,
send_threads, post_log, send_threads, post_log,
cached_webfingers, person_cache, cached_webfingers, person_cache,
post_json_object_copy, debug, post_json_object.copy(), debug,
project_version, project_version,
shared_items_federated_domains, shared_items_federated_domains,
shared_item_federation_tokens, shared_item_federation_tokens,

View File

@ -4950,10 +4950,10 @@ def _test_thread_functions():
arg_ctr += 1 arg_ctr += 1
continue continue
last_arg = False last_arg = False
if '(' in func_arg: if '(' in func_arg and '()' not in func_arg:
func_arg = func_arg.split('(')[1] func_arg = func_arg.split('(')[1]
if func_arg.endswith(')'): if func_arg.endswith(')') and '()' not in func_arg:
func_arg = func_arg.split(')')[0] func_arg = func_arg.split(')')[0]
last_arg = True last_arg = True
func_arg = func_arg.strip() func_arg = func_arg.strip()