MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / scheduleTransientRetry

Method scheduleTransientRetry

app/src/AI/Conversation.cpp:1046–1070  ·  view source on GitHub ↗

* @brief Drops the empty streaming placeholder row and re-issues the request after an * exponential backoff (1.5s, 3s). */

Source from the content-addressed store, hash-verified

1044 * exponential backoff (1.5s, 3s).
1045 */
1046void AI::Conversation::scheduleTransientRetry(const QString& message)
1047{
1048 ++m_retryCount;
1049 qCInfo(serialStudioAI) << "Transient provider error, retry" << m_retryCount << "of"
1050 << kMaxTransientRetries << ":" << message;
1051
1052 m_streamFlushTimer->stop();
1053 m_streamDirty = false;
1054 teardownReply();
1055
1056 if (m_assistantIndex >= 0 && m_assistantIndex < m_uiMessages.size()) {
1057 m_uiMessages.removeAt(m_assistantIndex);
1058 m_assistantIndex = -1;
1059 Q_EMIT messagesChanged();
1060 }
1061
1062 m_assistantText.clear();
1063 m_assistantThinking.clear();
1064
1065 const int delayMs = 1500 * (1 << (m_retryCount - 1));
1066 QTimer::singleShot(delayMs, this, [this]() {
1067 if (!m_cancelled && m_busy)
1068 issueRequest();
1069 });
1070}
1071
1072//--------------------------------------------------------------------------------------------------
1073// Internals

Callers

nothing calls this directly

Calls 3

stopMethod · 0.45
sizeMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected