MCPcopy Create free account
hub / github.com/Icinga/icinga2 / FireAndForgetQuery

Method FireAndForgetQuery

lib/icingadb/redisconnection.cpp:132–146  ·  view source on GitHub ↗

* 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

Source from the content-addressed store, hash-verified

130 * @param highPriority Whether the query should be treated with high priority.
131 */
132void 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

Callers 5

PublishStatsMethod · 0.80
DeleteKeysMethod · 0.80
UpdateStateMethod · 0.80
ProcessQueueItemMethod · 0.80

Calls 3

LogQueryFunction · 0.85
PushMethod · 0.45
SetMethod · 0.45

Tested by

no test coverage detected