Commit 1c7bd7d5 authored by Max Kellermann's avatar Max Kellermann

db/update/InotifyQueue: check for ACK_ERROR_UPDATE_ALREADY

Since commit cc64c715, UpdateService::Enqueue() throws ProtocolError(ACK_ERROR_UPDATE_ALREADY) instead of returning 0.
parent 3c4ed9cb
......@@ -21,6 +21,7 @@
#include "InotifyDomain.hxx"
#include "Service.hxx"
#include "Log.hxx"
#include "protocol/Ack.hxx" // for class ProtocolError
#include "util/StringCompare.hxx"
/**
......@@ -40,7 +41,17 @@ InotifyQueue::OnDelay() noexcept
const char *uri_utf8 = queue.front().c_str();
try {
id = update.Enqueue(uri_utf8, false);
try {
id = update.Enqueue(uri_utf8, false);
} catch (const ProtocolError &e) {
if (e.GetCode() == ACK_ERROR_UPDATE_ALREADY) {
/* retry later */
delay_event.Schedule(INOTIFY_UPDATE_DELAY);
return;
}
throw;
}
} catch (...) {
FormatError(std::current_exception(),
"Failed to enqueue '%s'", uri_utf8);
......@@ -48,12 +59,6 @@ InotifyQueue::OnDelay() noexcept
continue;
}
if (id == 0) {
/* retry later */
delay_event.Schedule(INOTIFY_UPDATE_DELAY);
return;
}
FormatDebug(inotify_domain, "updating '%s' job=%u",
uri_utf8, id);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment