Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ioc: fix dbLoadGroups command. #91

Closed
wants to merge 2 commits into from

Conversation

ericonr
Copy link
Contributor

@ericonr ericonr commented Nov 22, 2024

Calling GroupConfigProcessor().loadConfigFiles() reads and clears config.groupConfigFiles, and loads the JSON files before iocInit. When loadConfigFiles() is called again from an init-hook, config.groupConfigFiles is empty, and no JSON files are actually read, so no groups in those files are loaded.

This change removes error messages at the point where dbLoadGroup is called; errors are now displayed only during iocInit.


Fixes #88

I would like to add tests before merging this. Done!

I think I mostly understood what caused this problem, but I couldn't find where config.groupMap is cleared before/during iocInit, so I didn't understand why loadConfigFiles() before iocInit was an issue.

I'm assuming groupConfigFiles is cleared by std::move (this seems to be a correct assumption), but if there's some spot that simply clears the whole config, it might simply be cleared along with groupMap.

Calling GroupConfigProcessor().loadConfigFiles() reads and clears
config.groupConfigFiles, and loads the JSON files before iocInit. When
loadConfigFiles() is called again from an init-hook,
config.groupConfigFiles is empty, and no JSON files are actually read,
so no groups in those files are loaded.

This change removes error messages at the point where dbLoadGroup is
called; errors are now displayed only during iocInit.
@mdavidsaver
Copy link
Member

Thanks for figuring this out. Merged as of 8502f91 with some changes.

wrt. 28817ae New test data files need to be appended to the TESTFILES Make variable to be captured during build and made available when tests are run on an embedded target.

8502f91 adds an IOC state check to dbLoadGroup() to catch accidental calls after iocInit(), when it would not have effect.

@ericonr
Copy link
Contributor Author

ericonr commented Dec 12, 2024

Cheers, thank you for merging and fixing the necessary parts :)

@ericonr ericonr deleted the dbloadconfig branch December 12, 2024 19:21
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.

QSRV groups aren't created when loaded with dbLoadGroups in .cmd file
2 participants