youki icon indicating copy to clipboard operation
youki copied to clipboard

closes 3286 wait for job remove signal

Open cody-herbst opened this issue 1 month ago • 3 comments

Description

Type of Change

  • [ ] Bug fix (non-breaking change that fixes an issue)
  • [ ] New feature (non-breaking change that adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [ ] Documentation update
  • [ ] Refactoring (no functional changes)
  • [ ] Performance improvement
  • [ ] Test updates
  • [ ] CI/CD related changes
  • [ ] Other (please describe):

Testing

  • [ ] Added new unit tests
  • [ ] Added new integration tests
  • [ ] Ran existing test suite
  • [ ] Tested manually (please provide steps)

Related Issues

Fixes #

Additional Context

cody-herbst avatar Nov 23 '25 20:11 cody-herbst

@YJDoc2 / @utam0k / @CheatCodeSam

There is another option instead of spinning up a thread and creating a brand new dbus connection.

In theory we could call AddMatch and Subscribe on the existing dbus connection right before calling start_transient_unit. We read for the signal after the call finishes. Finally call Unsubscribe to stop systemd from sending us signals (I don't believe we need to remove the AddMatch rule). I'm a little nervous that the resulting signal could get mixed up with the start_transient_unit call but I don't think that can happen.

I'm not sure the above approach will be faster but I can test it out when I get home.

I didn't end up going the convar/mutex approach because the thread signaling involved became complicated. In order to avoid the unshared limitation, the thread had to be more or less confined to the add_task method. When creating the DBusConnection and subscribing, I ran into several cases were race conditions occurred without a lot thread signaling/waiting for other things to happen.

cody-herbst avatar Nov 23 '25 21:11 cody-herbst

I wrote up the synchronous implementation real quick. Going to run some perf tests to compare the two and ill post here. The we can figure out the better approach

cody-herbst avatar Nov 26 '25 06:11 cody-herbst

@YJDoc2 / @utam0k / @CheatCodeSam

I removed the threaded approach. From some testing doing it synchronously is both faster and easier on memory

cody-herbst avatar Nov 27 '25 00:11 cody-herbst

@saku3 so not sure why the previous checks have failed.... Linting seems to work just fine for me on local. I merged with main and pushed. Also it seems like the "enhancement" tag is causing an issue. I don't seem to have the permissions to change the tag.

cody-herbst avatar Dec 20 '25 18:12 cody-herbst