Skip to content

Commit

Permalink
All threads have been named (#443)
Browse files Browse the repository at this point in the history
  • Loading branch information
FarhanAnjum-opti authored Dec 11, 2024
1 parent 7fa6153 commit 45e73bb
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 5 deletions.
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

0 comments on commit 45e73bb

Please sign in to comment.