Skip to content

Refactored the code consistent with the rest of the daemons#25

Open
omanikhi wants to merge 5 commits into
masterfrom
high-cpu-loop-fix
Open

Refactored the code consistent with the rest of the daemons#25
omanikhi wants to merge 5 commits into
masterfrom
high-cpu-loop-fix

Conversation

@omanikhi

@omanikhi omanikhi commented Mar 27, 2026

Copy link
Copy Markdown
Contributor

…e Daemon, DaemonTask, BackgroundJob, BackgroundWorker.

- Use ArgumentParser instead of the outdated OptionParser
- Rename JobMulti -> HistoryDumpJob, JobMultiLoad -> HistoryLoadJob
- Fix pidfile write: os.open() returns an int, not a context manager; wrap with os.fdopen()
- Fix flags/mode tuple bug: comma made them a tuple instead of separate arguments
- get_head now uses execute() from util instead of a manual svnlook|grep pipe;
  svnlook youngest outputs only the revision number so grep was redundant
- Remove unused check_call wrapper and its assert (dead code)
heapq falls through to compare Job instances as a tiebreaker when rev is
equal, which fails since BackgroundJob has no ordering. Add an itertools
counter as a middle element in the priority tuple to prevent this.
- _get_svn_dump_args: was __ which caused a name-mangling AttributeError
  when called from HistoryDumpJob; changed to _ since subclasses need it
- Align _get_key, _get_name, _validate_shard, _get_head, _get_shards
  to single underscore where subclasses access them, double underscore
  where the method is strictly internal to the defining class
@omanikhi omanikhi requested a review from takesson March 31, 2026 06:39
@omanikhi

Copy link
Copy Markdown
Contributor Author

@takesson Could you test it as well? I wrote a script and verified the fix for queue and also tested the --load and --history but I'm not sure I did it right.

- tests/bgworkertest.py: test for BackgroundWorker.queue with same-rev jobs
- pytest.ini: configures testpaths, *test.py pattern, and JUnit XML output
- run-tests.sh: convenience script delegating to pytest
- .gitignore: exclude generated test-reports/ directory
@takesson

Copy link
Copy Markdown
Member

I am not brave enough to merge this before CMS 5.3.

Do we have a reference back to the issue / thread in Slack?

@takesson

Copy link
Copy Markdown
Member

I have released 1.4.0 without this PR.

@omanikhi

omanikhi commented Jun 2, 2026

Copy link
Copy Markdown
Contributor Author

I am not brave enough to merge this before CMS 5.3.

Do we have a reference back to the issue / thread in Slack?

Yes, I've now added it to the description.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants