1
0
Fork 0

[3.4] fix agency lockup when removing 404-ed callbacks (#9839)

This commit is contained in:
Kaveh Vahedipour 2019-08-29 12:19:12 +02:00 committed by KVS85
parent 8e37de426d
commit 3f554f15d1
1 changed files with 15 additions and 4 deletions

View File

@ -31,11 +31,13 @@
#include "Agency/AgentCallback.h"
#include "Agency/GossipCallback.h"
#include "Agency/AgencyFeature.h"
#include "Basics/ConditionLocker.h"
#include "Basics/ReadLocker.h"
#include "Basics/WriteLocker.h"
#include "RestServer/QueryRegistryFeature.h"
#include "RestServer/SystemDatabaseFeature.h"
#include "Scheduler/SchedulerFeature.h"
#include "VocBase/vocbase.h"
using namespace arangodb::application_features;
@ -1960,10 +1962,19 @@ void Agent::emptyCbTrashBin() {
_callbackLastPurged = std::chrono::steady_clock::now();
}
LOG_TOPIC(DEBUG, Logger::AGENCY) << "unobserving: " << envelope->toJson();
// Best effort. Will be retried anyway
auto wres = write(envelope);
// Best effort. Will be retried otherwise.
LOG_TOPIC(DEBUG, Logger::AGENCY) << "scheduling unobserve: " << envelope->toJson();
auto* scheduler = SchedulerFeature::SCHEDULER;
if (scheduler != nullptr) {
scheduler->queue(
RequestPriority::LOW, [envelope](bool) {
auto* agent = AgencyFeature::AGENT;
if (!application_features::ApplicationServer::isStopping() && agent) {
agent->write(envelope);
}
});
}
}