Skip to content

[FSSDK-10866] maintenance: Name all the different types of threads #443

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ MANIFEST
.idea/*
.*virtualenv/*
.mypy_cache
.vscode/*

# Output of building package
*.egg-info
Expand All @@ -26,3 +27,4 @@ datafile.json

# Sphinx documentation
docs/build/

2 changes: 1 addition & 1 deletion optimizely/config_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ def start(self) -> None:
self._polling_thread.start()

def _initialize_thread(self) -> None:
self._polling_thread = threading.Thread(target=self._run, daemon=True)
self._polling_thread = threading.Thread(target=self._run, name="PollThread", daemon=True)


class AuthDatafilePollingConfigManager(PollingConfigManager):
Expand Down
3 changes: 1 addition & 2 deletions optimizely/event/event_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,7 @@ def start(self) -> None:
return

self.flushing_interval_deadline = self._get_time() + self._get_time(self.flush_interval.total_seconds())
self.executor = threading.Thread(target=self._run)
self.executor.daemon = True
self.executor = threading.Thread(target=self._run, name="EventThread", daemon=True)
self.executor.start()

def _run(self) -> None:
Expand Down
2 changes: 1 addition & 1 deletion optimizely/odp/odp_event_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def __init__(
self.retry_count = OdpEventManagerConfig.DEFAULT_RETRY_COUNT
self._current_batch: list[OdpEvent] = []
"""_current_batch should only be modified by the processing thread, as it is not thread safe"""
self.thread = Thread(target=self._run, daemon=True)
self.thread = Thread(target=self._run, name="OdpThread", daemon=True)
self.thread_exception = False
"""thread_exception will be True if the processing thread did not exit cleanly"""

Expand Down
2 changes: 1 addition & 1 deletion optimizely/optimizely_user_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ def _fetch_qualified_segments() -> bool:
return success

if callback:
fetch_thread = threading.Thread(target=_fetch_qualified_segments)
fetch_thread = threading.Thread(target=_fetch_qualified_segments, name="FetchQualifiedSegmentsThread")
fetch_thread.start()
return fetch_thread
else:
Expand Down
Loading