* @brief Compiles the script when scriptCode has changed since the last successful compile. */
| 448 | * @brief Compiles the script when scriptCode has changed since the last successful compile. |
| 449 | */ |
| 450 | void MQTT::PublisherWorker::recompileScriptIfNeeded() |
| 451 | { |
| 452 | if (!m_script) |
| 453 | return; |
| 454 | |
| 455 | const bool sameCode = (m_cfg.scriptCode == m_compiledScriptCode); |
| 456 | const bool sameLang = (m_cfg.scriptLanguage == m_script->currentLanguage()); |
| 457 | if (sameCode && sameLang && m_script->isLoaded()) |
| 458 | return; |
| 459 | |
| 460 | m_compiledScriptCode = m_cfg.scriptCode; |
| 461 | QString error; |
| 462 | if (!m_script->compile(m_cfg.scriptCode, m_cfg.scriptLanguage, error)) |
| 463 | Q_EMIT scriptErrorOccurred(error); |
| 464 | } |
| 465 | |
| 466 | /** |
| 467 | * @brief Publishes a payload and increments the stats counters. |
nothing calls this directly
no test coverage detected