Skip to content

Fix: reduce MSSQL connections per collect; add unit tests#176

Draft
Rom1-B wants to merge 2 commits into
mainfrom
fix_mssql_connection
Draft

Fix: reduce MSSQL connections per collect; add unit tests#176
Rom1-B wants to merge 2 commits into
mainfrom
fix_mssql_connection

Conversation

@Rom1-B
Copy link
Copy Markdown
Contributor

@Rom1-B Rom1-B commented May 25, 2026

Checklist before requesting a review

  • I have performed a self-review of my code.
  • I have added tests (when available) that prove my fix is effective or that my feature works.
  • I have updated the CHANGELOG with a short functional description of the fix or new feature.
  • This change requires a documentation update.

Description

Each collect run was opening up to N*8 MSSQL connections (one per get*() method per device).
A single PluginSccmSccmdb is now created once per config in executeCollect() and passed to all per-device data fetching methods, reducing connections to 2 per config regardless of device count.
The set*() methods in PluginSccmSccmxml accept an optional ?PluginSccmSccm parameter for dependency injection, enabling a PHPUnit test suite covering query building, XML generation, and data transformation logic (47 tests, 209 assertions).

@Rom1-B Rom1-B requested a review from stonebuzz May 25, 2026 07:48
@Rom1-B Rom1-B mentioned this pull request May 25, 2026
4 tasks
@Rom1-B Rom1-B marked this pull request as draft May 25, 2026 08:02
@tolemac
Copy link
Copy Markdown
Contributor

tolemac commented May 25, 2026

@Rom1-B Tell me when I can test it in my environment.

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