* Queue a Redis query for sending without waiting for the response in a fire-and-forget manner. * * If the highPriority flag is set to true, the query is treated with high priority and placed at the front of * the write queue, ensuring it is sent before other queued queries. This is useful for time-sensitive operations * that require to be executed promptly, which is the case for IcingaDB hear
| 130 | * @param highPriority Whether the query should be treated with high priority. |
| 131 | */ |
| 132 | void RedisConnection::FireAndForgetQuery(Query query, QueryAffects affects, bool highPriority) |
| 133 | { |
| 134 | if (LogDebug >= Logger::GetMinLogSeverity()) { |
| 135 | Log msg (LogDebug, "IcingaDB", "Firing and forgetting query:"); |
| 136 | LogQuery(query, msg); |
| 137 | } |
| 138 | |
| 139 | auto item (Shared<Query>::Make(std::move(query))); |
| 140 | |
| 141 | asio::post(m_Strand, [this, item, highPriority, affects, ctime = Utility::GetTime()]() { |
| 142 | m_Queues.Push(WriteQueueItem{item, ctime, affects}, highPriority); |
| 143 | m_QueuedWrites.Set(); |
| 144 | IncreasePendingQueries(1); |
| 145 | }); |
| 146 | } |
| 147 | |
| 148 | /** |
| 149 | * Queue Redis queries for sending |
no test coverage detected