db/update/InotifyQueue: check for ACK_ERROR_UPDATE_ALREADY
Since commit cc64c715a2
, UpdateService::Enqueue() throws
ProtocolError(ACK_ERROR_UPDATE_ALREADY) instead of returning 0.
This commit is contained in:
parent
3c4ed9cbe3
commit
1c7bd7d5c4
@ -21,6 +21,7 @@
|
|||||||
#include "InotifyDomain.hxx"
|
#include "InotifyDomain.hxx"
|
||||||
#include "Service.hxx"
|
#include "Service.hxx"
|
||||||
#include "Log.hxx"
|
#include "Log.hxx"
|
||||||
|
#include "protocol/Ack.hxx" // for class ProtocolError
|
||||||
#include "util/StringCompare.hxx"
|
#include "util/StringCompare.hxx"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -39,8 +40,18 @@ InotifyQueue::OnDelay() noexcept
|
|||||||
while (!queue.empty()) {
|
while (!queue.empty()) {
|
||||||
const char *uri_utf8 = queue.front().c_str();
|
const char *uri_utf8 = queue.front().c_str();
|
||||||
|
|
||||||
|
try {
|
||||||
try {
|
try {
|
||||||
id = update.Enqueue(uri_utf8, false);
|
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 (...) {
|
} catch (...) {
|
||||||
FormatError(std::current_exception(),
|
FormatError(std::current_exception(),
|
||||||
"Failed to enqueue '%s'", uri_utf8);
|
"Failed to enqueue '%s'", uri_utf8);
|
||||||
@ -48,12 +59,6 @@ InotifyQueue::OnDelay() noexcept
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (id == 0) {
|
|
||||||
/* retry later */
|
|
||||||
delay_event.Schedule(INOTIFY_UPDATE_DELAY);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
FormatDebug(inotify_domain, "updating '%s' job=%u",
|
FormatDebug(inotify_domain, "updating '%s' job=%u",
|
||||||
uri_utf8, id);
|
uri_utf8, id);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user