Refactoring to only query MySQL once
Refactoring to only query MySQL once

bencer/sd-agent-plugins,shanethehat/sd-agent-plugins,shanethehat/sd-agent-plugins,bencer/sd-agent-plugins,bastiendonjon/sd-agent-plugins,bastiendonjon/sd-agent-plugins