Skip to content

Conversation

@MelkorBalrog
Copy link
Owner

Summary

  • add tools.service_manager to pause and resume service threads instead of killing them
  • cover service manager lifecycle with regression tests
  • bump version to 0.2.213 and document the change

Testing

  • pytest tests/thread_manager/test_service_manager.py -q
  • pytest --maxfail=1 -q (fails: tests/governance/test_governance_cut_paste.py::test_cut_paste_task_between_governance_diagrams)
  • python tools/metrics_generator.py --path . --output metrics.json

https://chatgpt.com/codex/tasks/task_b_68b19f73453483279b7a5aaa9935c7c8

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codex Review: Here are some suggestions.

Reply with @codex fix comments to fix any unresolved comments.

About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".

Comment on lines +96 to +108
def release(self, name: str) -> None:
"""Decrease reference count and pause service when unused."""
with self._lock:
entry = self._services.get(name)
if not entry:
return
svc, count = entry
count -= 1
if count <= 0:
self._services[name] = (svc, 0)
svc.pause()
else:
self._services[name] = (svc, count)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] Pause services even when references remain

The new ServiceManager.release pauses the service regardless of the remaining reference count. When a service is acquired by multiple clients, the first release call decrements the count to >0 but still invokes svc.pause(), leaving the thread suspended while other clients still expect it to run. Those clients never resume the service because they already hold their reference, so their work stalls until they call acquire again. Pausing should only occur when the reference count reaches zero.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant