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 "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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user