|
31 | 31 |
|
32 | 32 | #include "Agency/AgentCallback.h"
|
33 | 33 | #include "Agency/GossipCallback.h"
|
| 34 | +#include "Agency/AgencyFeature.h" |
34 | 35 | #include "Basics/ConditionLocker.h"
|
35 | 36 | #include "Basics/ReadLocker.h"
|
36 | 37 | #include "Basics/WriteLocker.h"
|
37 | 38 | #include "RestServer/QueryRegistryFeature.h"
|
38 | 39 | #include "RestServer/SystemDatabaseFeature.h"
|
| 40 | +#include "Scheduler/SchedulerFeature.h" |
39 | 41 | #include "VocBase/vocbase.h"
|
40 | 42 |
|
41 | 43 | using namespace arangodb::application_features;
|
@@ -1960,10 +1962,19 @@ void Agent::emptyCbTrashBin() {
|
1960 | 1962 | _callbackLastPurged = std::chrono::steady_clock::now();
|
1961 | 1963 | }
|
1962 | 1964 |
|
1963 |
| - LOG_TOPIC(DEBUG, Logger::AGENCY) << "unobserving: " << envelope->toJson(); |
1964 |
| - |
1965 |
| - // Best effort. Will be retried anyway |
1966 |
| - auto wres = write(envelope); |
| 1965 | + // Best effort. Will be retried otherwise. |
| 1966 | + LOG_TOPIC(DEBUG, Logger::AGENCY) << "scheduling unobserve: " << envelope->toJson(); |
| 1967 | + auto* scheduler = SchedulerFeature::SCHEDULER; |
| 1968 | + |
| 1969 | + if (scheduler != nullptr) { |
| 1970 | + scheduler->queue( |
| 1971 | + RequestPriority::LOW, [envelope](bool) { |
| 1972 | + auto* agent = AgencyFeature::AGENT; |
| 1973 | + if (!application_features::ApplicationServer::isStopping() && agent) { |
| 1974 | + agent->write(envelope); |
| 1975 | + } |
| 1976 | + }); |
| 1977 | + } |
1967 | 1978 |
|
1968 | 1979 | }
|
1969 | 1980 |
|
|
0 commit comments