Leonid Baraz | 61437cb | 2021-02-26 20:43:06 | [diff] [blame] | 1 | // Copyright 2020 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
Leonid Baraz | f10cae8 | 2021-09-14 00:59:38 | [diff] [blame] | 5 | #include "components/reporting/client/report_queue_impl.h" |
Leonid Baraz | 61437cb | 2021-02-26 20:43:06 | [diff] [blame] | 6 | |
| 7 | #include <memory> |
Leonid Baraz | f84aa6c | 2021-12-13 19:38:20 | [diff] [blame] | 8 | #include <queue> |
Leonid Baraz | 61437cb | 2021-02-26 20:43:06 | [diff] [blame] | 9 | #include <string> |
| 10 | #include <utility> |
| 11 | |
| 12 | #include "base/bind.h" |
| 13 | #include "base/callback.h" |
Ahmed Nasr | f21e843 | 2022-07-30 00:48:37 | [diff] [blame] | 14 | #include "base/check.h" |
Leonid Baraz | 61437cb | 2021-02-26 20:43:06 | [diff] [blame] | 15 | #include "base/memory/ptr_util.h" |
Leonid Baraz | 61437cb | 2021-02-26 20:43:06 | [diff] [blame] | 16 | #include "base/memory/scoped_refptr.h" |
Leonid Baraz | b8c27535 | 2021-08-05 00:59:09 | [diff] [blame] | 17 | #include "base/notreached.h" |
Leonid Baraz | 61437cb | 2021-02-26 20:43:06 | [diff] [blame] | 18 | #include "base/sequence_checker.h" |
Patrick Monette | 643cdf6 | 2021-10-15 19:13:42 | [diff] [blame] | 19 | #include "base/task/bind_post_task.h" |
Leonid Baraz | 61437cb | 2021-02-26 20:43:06 | [diff] [blame] | 20 | #include "base/task/task_traits.h" |
| 21 | #include "base/task/thread_pool.h" |
| 22 | #include "base/time/time.h" |
Leonid Baraz | caac7c9 | 2021-03-04 17:34:05 | [diff] [blame] | 23 | #include "components/reporting/client/report_queue_configuration.h" |
Josh Hilke | e7a4699 | 2021-10-21 20:21:19 | [diff] [blame] | 24 | #include "components/reporting/proto/synced/record.pb.h" |
| 25 | #include "components/reporting/proto/synced/record_constants.pb.h" |
Leonid Baraz | 61437cb | 2021-02-26 20:43:06 | [diff] [blame] | 26 | #include "components/reporting/storage/storage_module_interface.h" |
| 27 | #include "components/reporting/util/status.h" |
Leonid Baraz | 61437cb | 2021-02-26 20:43:06 | [diff] [blame] | 28 | #include "components/reporting/util/statusor.h" |
| 29 | |
| 30 | namespace reporting { |
Leonid Baraz | f8a9daf | 2022-06-02 01:09:35 | [diff] [blame] | 31 | namespace { |
| 32 | // Calls |record_producer|, checks the result and in case of success, forwards |
| 33 | // it to the storage. In production code should be invoked asynchronously, on a |
| 34 | // thread pool (no synchronization expected). |
| 35 | void AddRecordToStorage(scoped_refptr<StorageModuleInterface> storage, |
| 36 | Priority priority, |
| 37 | std::string dm_token, |
| 38 | Destination destination, |
| 39 | ReportQueue::RecordProducer record_producer, |
| 40 | StorageModuleInterface::EnqueueCallback callback) { |
Leonid Baraz | 8e2830e | 2022-06-02 20:26:50 | [diff] [blame] | 41 | // Generate record data. |
Leonid Baraz | f8a9daf | 2022-06-02 01:09:35 | [diff] [blame] | 42 | auto record_result = std::move(record_producer).Run(); |
| 43 | if (!record_result.ok()) { |
| 44 | std::move(callback).Run(record_result.status()); |
| 45 | return; |
| 46 | } |
| 47 | |
| 48 | // Augment data. |
| 49 | Record record; |
| 50 | *record.mutable_data() = std::move(record_result.ValueOrDie()); |
| 51 | record.set_destination(destination); |
| 52 | |
Leonid Baraz | 8e2830e | 2022-06-02 20:26:50 | [diff] [blame] | 53 | // |record| with no DM token is assumed to be associated with device DM token |
Leonid Baraz | f8a9daf | 2022-06-02 01:09:35 | [diff] [blame] | 54 | if (!dm_token.empty()) { |
| 55 | *record.mutable_dm_token() = std::move(dm_token); |
| 56 | } |
| 57 | |
| 58 | // Calculate timestamp in microseconds - to match Spanner expectations. |
| 59 | const int64_t time_since_epoch_us = |
| 60 | base::Time::Now().ToJavaTime() * base::Time::kMicrosecondsPerMillisecond; |
| 61 | record.set_timestamp_us(time_since_epoch_us); |
| 62 | if (!record_result.ok()) { |
| 63 | std::move(callback).Run(record_result.status()); |
| 64 | return; |
| 65 | } |
| 66 | |
| 67 | // Add resulting Record to the storage. |
| 68 | storage->AddRecord(priority, std::move(record), std::move(callback)); |
| 69 | } |
| 70 | } // namespace |
Leonid Baraz | 61437cb | 2021-02-26 20:43:06 | [diff] [blame] | 71 | |
Leonid Baraz | 4d49766a | 2021-10-16 23:50:48 | [diff] [blame] | 72 | void ReportQueueImpl::Create( |
Leonid Baraz | 61437cb | 2021-02-26 20:43:06 | [diff] [blame] | 73 | std::unique_ptr<ReportQueueConfiguration> config, |
Leonid Baraz | 4d49766a | 2021-10-16 23:50:48 | [diff] [blame] | 74 | scoped_refptr<StorageModuleInterface> storage, |
| 75 | base::OnceCallback<void(StatusOr<std::unique_ptr<ReportQueue>>)> cb) { |
| 76 | std::move(cb).Run(base::WrapUnique<ReportQueueImpl>( |
| 77 | new ReportQueueImpl(std::move(config), storage))); |
Leonid Baraz | 61437cb | 2021-02-26 20:43:06 | [diff] [blame] | 78 | } |
| 79 | |
Leonid Baraz | 61437cb | 2021-02-26 20:43:06 | [diff] [blame] | 80 | ReportQueueImpl::ReportQueueImpl( |
| 81 | std::unique_ptr<ReportQueueConfiguration> config, |
| 82 | scoped_refptr<StorageModuleInterface> storage) |
Leonid Baraz | f8a9daf | 2022-06-02 01:09:35 | [diff] [blame] | 83 | : config_(std::move(config)), storage_(storage) {} |
Leonid Baraz | 61437cb | 2021-02-26 20:43:06 | [diff] [blame] | 84 | |
Leonid Baraz | f8a9daf | 2022-06-02 01:09:35 | [diff] [blame] | 85 | ReportQueueImpl::~ReportQueueImpl() = default; |
| 86 | |
| 87 | void ReportQueueImpl::AddProducedRecord(RecordProducer record_producer, |
| 88 | Priority priority, |
| 89 | EnqueueCallback callback) const { |
Leonid Baraz | 61437cb | 2021-02-26 20:43:06 | [diff] [blame] | 90 | const Status status = config_->CheckPolicy(); |
| 91 | if (!status.ok()) { |
| 92 | std::move(callback).Run(status); |
| 93 | return; |
| 94 | } |
| 95 | |
| 96 | if (priority == Priority::UNDEFINED_PRIORITY) { |
| 97 | std::move(callback).Run( |
| 98 | Status(error::INVALID_ARGUMENT, "Priority must be defined")); |
| 99 | return; |
| 100 | } |
| 101 | |
Leonid Baraz | f8a9daf | 2022-06-02 01:09:35 | [diff] [blame] | 102 | // Execute |record_producer| on arbitrary thread, analyze the result and send |
| 103 | // it to the Storage, returning with the callback. |
| 104 | base::ThreadPool::PostTask( |
| 105 | FROM_HERE, {base::TaskPriority::BEST_EFFORT}, |
| 106 | base::BindOnce(&AddRecordToStorage, storage_, priority, |
| 107 | config_->dm_token(), config_->destination(), |
| 108 | std::move(record_producer), std::move(callback))); |
Leonid Baraz | 61437cb | 2021-02-26 20:43:06 | [diff] [blame] | 109 | } |
| 110 | |
Leonid Baraz | 4542951 | 2021-03-12 18:20:12 | [diff] [blame] | 111 | void ReportQueueImpl::Flush(Priority priority, FlushCallback callback) { |
| 112 | storage_->Flush(priority, std::move(callback)); |
| 113 | } |
| 114 | |
Leonid Baraz | b8c27535 | 2021-08-05 00:59:09 | [diff] [blame] | 115 | base::OnceCallback<void(StatusOr<std::unique_ptr<ReportQueue>>)> |
| 116 | ReportQueueImpl::PrepareToAttachActualQueue() const { |
| 117 | NOTREACHED(); |
| 118 | return base::BindOnce( |
| 119 | [](StatusOr<std::unique_ptr<ReportQueue>>) { NOTREACHED(); }); |
| 120 | } |
| 121 | |
Leonid Baraz | 8e2830e | 2022-06-02 20:26:50 | [diff] [blame] | 122 | // Implementation of SpeculativeReportQueueImpl::PendingRecordProducer |
| 123 | |
| 124 | SpeculativeReportQueueImpl::PendingRecordProducer::PendingRecordProducer( |
| 125 | RecordProducer producer, |
| 126 | Priority priority) |
| 127 | : record_producer(std::move(producer)), record_priority(priority) {} |
| 128 | |
| 129 | SpeculativeReportQueueImpl::PendingRecordProducer::PendingRecordProducer( |
| 130 | PendingRecordProducer&& other) |
| 131 | : record_producer(std::move(other.record_producer)), |
| 132 | record_priority(other.record_priority) {} |
| 133 | |
| 134 | SpeculativeReportQueueImpl::PendingRecordProducer::~PendingRecordProducer() = |
| 135 | default; |
| 136 | |
| 137 | SpeculativeReportQueueImpl::PendingRecordProducer& |
| 138 | SpeculativeReportQueueImpl::PendingRecordProducer::operator=( |
| 139 | PendingRecordProducer&& other) { |
| 140 | record_producer = std::move(other.record_producer); |
| 141 | record_priority = other.record_priority; |
| 142 | return *this; |
| 143 | } |
| 144 | |
Leonid Baraz | b8c27535 | 2021-08-05 00:59:09 | [diff] [blame] | 145 | // static |
| 146 | std::unique_ptr<SpeculativeReportQueueImpl, base::OnTaskRunnerDeleter> |
| 147 | SpeculativeReportQueueImpl::Create() { |
| 148 | scoped_refptr<base::SequencedTaskRunner> sequenced_task_runner = |
| 149 | base::ThreadPool::CreateSequencedTaskRunner( |
| 150 | {base::TaskPriority::BEST_EFFORT, base::MayBlock()}); |
| 151 | return std::unique_ptr<SpeculativeReportQueueImpl, base::OnTaskRunnerDeleter>( |
| 152 | new SpeculativeReportQueueImpl(sequenced_task_runner), |
| 153 | base::OnTaskRunnerDeleter(sequenced_task_runner)); |
| 154 | } |
| 155 | |
| 156 | SpeculativeReportQueueImpl::SpeculativeReportQueueImpl( |
| 157 | scoped_refptr<base::SequencedTaskRunner> sequenced_task_runner) |
| 158 | : sequenced_task_runner_(sequenced_task_runner) { |
| 159 | DETACH_FROM_SEQUENCE(sequence_checker_); |
| 160 | } |
| 161 | |
| 162 | SpeculativeReportQueueImpl::~SpeculativeReportQueueImpl() { |
| 163 | DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
| 164 | } |
| 165 | |
| 166 | void SpeculativeReportQueueImpl::Flush(Priority priority, |
| 167 | FlushCallback callback) { |
| 168 | sequenced_task_runner_->PostTask( |
| 169 | FROM_HERE, |
| 170 | base::BindOnce( |
| 171 | [](Priority priority, FlushCallback callback, |
| 172 | base::WeakPtr<SpeculativeReportQueueImpl> self) { |
| 173 | if (!self) { |
| 174 | std::move(callback).Run( |
| 175 | Status(error::UNAVAILABLE, "Queue has been destructed")); |
| 176 | return; |
| 177 | } |
| 178 | DCHECK_CALLED_ON_VALID_SEQUENCE(self->sequence_checker_); |
Ahmed Nasr | f21e843 | 2022-07-30 00:48:37 | [diff] [blame] | 179 | if (!self->status_or_report_queue_.has_value()) { |
Leonid Baraz | b8c27535 | 2021-08-05 00:59:09 | [diff] [blame] | 180 | std::move(callback).Run(Status(error::FAILED_PRECONDITION, |
| 181 | "ReportQueue is not ready yet.")); |
| 182 | return; |
| 183 | } |
Ahmed Nasr | f21e843 | 2022-07-30 00:48:37 | [diff] [blame] | 184 | if (!self->status_or_report_queue_->ok()) { |
| 185 | std::move(callback).Run(self->status_or_report_queue_->status()); |
| 186 | return; |
| 187 | } |
| 188 | const std::unique_ptr<ReportQueue>& report_queue = |
| 189 | self->status_or_report_queue_->ValueOrDie(); |
| 190 | report_queue->Flush(priority, std::move(callback)); |
Leonid Baraz | b8c27535 | 2021-08-05 00:59:09 | [diff] [blame] | 191 | }, |
| 192 | priority, std::move(callback), weak_ptr_factory_.GetWeakPtr())); |
| 193 | } |
| 194 | |
Leonid Baraz | f8a9daf | 2022-06-02 01:09:35 | [diff] [blame] | 195 | void SpeculativeReportQueueImpl::AddProducedRecord( |
| 196 | RecordProducer record_producer, |
| 197 | Priority priority, |
| 198 | EnqueueCallback callback) const { |
| 199 | // Invoke producer on a thread pool, then enqueue record on sequenced task |
| 200 | // runner. |
Leonid Baraz | 8e2830e | 2022-06-02 20:26:50 | [diff] [blame] | 201 | sequenced_task_runner_->PostTask( |
| 202 | FROM_HERE, |
| 203 | base::BindOnce(&SpeculativeReportQueueImpl::MaybeEnqueueRecordProducer, |
| 204 | weak_ptr_factory_.GetWeakPtr(), priority, |
| 205 | std::move(callback), std::move(record_producer))); |
Leonid Baraz | b8c27535 | 2021-08-05 00:59:09 | [diff] [blame] | 206 | } |
| 207 | |
Leonid Baraz | 8e2830e | 2022-06-02 20:26:50 | [diff] [blame] | 208 | void SpeculativeReportQueueImpl::MaybeEnqueueRecordProducer( |
Leonid Baraz | b8c27535 | 2021-08-05 00:59:09 | [diff] [blame] | 209 | Priority priority, |
Leonid Baraz | f8a9daf | 2022-06-02 01:09:35 | [diff] [blame] | 210 | EnqueueCallback callback, |
Leonid Baraz | 8e2830e | 2022-06-02 20:26:50 | [diff] [blame] | 211 | RecordProducer record_producer) const { |
Leonid Baraz | b8c27535 | 2021-08-05 00:59:09 | [diff] [blame] | 212 | DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
Ahmed Nasr | f21e843 | 2022-07-30 00:48:37 | [diff] [blame] | 213 | if (!status_or_report_queue_.has_value()) { |
| 214 | // Queue is not ready yet, store the record in the memory queue. |
Leonid Baraz | 8e2830e | 2022-06-02 20:26:50 | [diff] [blame] | 215 | pending_record_producers_.emplace(std::move(record_producer), priority); |
Leonid Baraz | b8c27535 | 2021-08-05 00:59:09 | [diff] [blame] | 216 | std::move(callback).Run(Status::StatusOK()); |
| 217 | return; |
| 218 | } |
Ahmed Nasr | f21e843 | 2022-07-30 00:48:37 | [diff] [blame] | 219 | if (!status_or_report_queue_->ok()) { |
| 220 | // Queue creation failed. |
| 221 | std::move(callback).Run(status_or_report_queue_->status()); |
| 222 | return; |
| 223 | } |
| 224 | // Queue is ready. If memory queue is empty, just forward the record. |
Leonid Baraz | 8e2830e | 2022-06-02 20:26:50 | [diff] [blame] | 225 | if (pending_record_producers_.empty()) { |
Ahmed Nasr | f21e843 | 2022-07-30 00:48:37 | [diff] [blame] | 226 | const std::unique_ptr<ReportQueue>& report_queue = |
| 227 | status_or_report_queue_->ValueOrDie(); |
| 228 | report_queue->AddProducedRecord(std::move(record_producer), priority, |
| 229 | std::move(callback)); |
Leonid Baraz | b8c27535 | 2021-08-05 00:59:09 | [diff] [blame] | 230 | return; |
| 231 | } |
| 232 | // If memory queue is not empty, attach the new record at the |
| 233 | // end and initiate enqueuing of everything from there. |
Leonid Baraz | 8e2830e | 2022-06-02 20:26:50 | [diff] [blame] | 234 | pending_record_producers_.emplace(std::move(record_producer), priority); |
| 235 | EnqueuePendingRecordProducers(std::move(callback)); |
Leonid Baraz | b8c27535 | 2021-08-05 00:59:09 | [diff] [blame] | 236 | } |
| 237 | |
Leonid Baraz | 8e2830e | 2022-06-02 20:26:50 | [diff] [blame] | 238 | void SpeculativeReportQueueImpl::EnqueuePendingRecordProducers( |
Leonid Baraz | b8c27535 | 2021-08-05 00:59:09 | [diff] [blame] | 239 | EnqueueCallback callback) const { |
| 240 | DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
Ahmed Nasr | f21e843 | 2022-07-30 00:48:37 | [diff] [blame] | 241 | DCHECK(status_or_report_queue_.has_value()); |
| 242 | DCHECK(status_or_report_queue_->ok()); |
Leonid Baraz | 8e2830e | 2022-06-02 20:26:50 | [diff] [blame] | 243 | if (pending_record_producers_.empty()) { |
Ahmed Nasr | d6d02da7 | 2022-04-13 18:07:41 | [diff] [blame] | 244 | std::move(callback).Run(Status::StatusOK()); |
| 245 | return; |
| 246 | } |
Ahmed Nasr | f21e843 | 2022-07-30 00:48:37 | [diff] [blame] | 247 | const std::unique_ptr<ReportQueue>& report_queue = |
| 248 | status_or_report_queue_->ValueOrDie(); |
Ahmed Nasr | d6d02da7 | 2022-04-13 18:07:41 | [diff] [blame] | 249 | |
Leonid Baraz | 8e2830e | 2022-06-02 20:26:50 | [diff] [blame] | 250 | auto head = std::move(pending_record_producers_.front()); |
| 251 | pending_record_producers_.pop(); |
| 252 | if (pending_record_producers_.empty()) { |
Leonid Baraz | b8c27535 | 2021-08-05 00:59:09 | [diff] [blame] | 253 | // Last of the pending records. |
Ahmed Nasr | f21e843 | 2022-07-30 00:48:37 | [diff] [blame] | 254 | report_queue->AddProducedRecord(std::move(head.record_producer), |
| 255 | head.record_priority, std::move(callback)); |
Leonid Baraz | b8c27535 | 2021-08-05 00:59:09 | [diff] [blame] | 256 | return; |
| 257 | } |
Ahmed Nasr | f21e843 | 2022-07-30 00:48:37 | [diff] [blame] | 258 | report_queue->AddProducedRecord( |
Leonid Baraz | 8e2830e | 2022-06-02 20:26:50 | [diff] [blame] | 259 | std::move(head.record_producer), head.record_priority, |
Leonid Baraz | b8c27535 | 2021-08-05 00:59:09 | [diff] [blame] | 260 | base::BindPostTask( |
| 261 | sequenced_task_runner_, |
| 262 | base::BindOnce( |
| 263 | [](base::WeakPtr<const SpeculativeReportQueueImpl> self, |
| 264 | EnqueueCallback callback, Status status) { |
| 265 | if (!status.ok()) { |
| 266 | std::move(callback).Run(status); |
| 267 | return; |
| 268 | } |
| 269 | if (!self) { |
| 270 | std::move(callback).Run( |
| 271 | Status(error::UNAVAILABLE, "Queue has been destructed")); |
| 272 | return; |
| 273 | } |
| 274 | self->sequenced_task_runner_->PostTask( |
Leonid Baraz | 8e2830e | 2022-06-02 20:26:50 | [diff] [blame] | 275 | FROM_HERE, base::BindOnce(&SpeculativeReportQueueImpl:: |
| 276 | EnqueuePendingRecordProducers, |
| 277 | self, std::move(callback))); |
Leonid Baraz | b8c27535 | 2021-08-05 00:59:09 | [diff] [blame] | 278 | }, |
| 279 | weak_ptr_factory_.GetWeakPtr(), std::move(callback)))); |
| 280 | } |
| 281 | |
| 282 | base::OnceCallback<void(StatusOr<std::unique_ptr<ReportQueue>>)> |
| 283 | SpeculativeReportQueueImpl::PrepareToAttachActualQueue() const { |
| 284 | return base::BindPostTask( |
| 285 | sequenced_task_runner_, |
| 286 | base::BindOnce( |
| 287 | [](base::WeakPtr<SpeculativeReportQueueImpl> speculative_queue, |
| 288 | StatusOr<std::unique_ptr<ReportQueue>> actual_queue_result) { |
| 289 | if (!speculative_queue) { |
| 290 | return; // Speculative queue was destructed in a meantime. |
| 291 | } |
Leonid Baraz | b8c27535 | 2021-08-05 00:59:09 | [diff] [blame] | 292 | // Set actual queue for the speculative queue to use |
| 293 | // (asynchronously). |
| 294 | speculative_queue->AttachActualQueue( |
Ahmed Nasr | f21e843 | 2022-07-30 00:48:37 | [diff] [blame] | 295 | std::move(std::move(actual_queue_result))); |
Leonid Baraz | b8c27535 | 2021-08-05 00:59:09 | [diff] [blame] | 296 | }, |
| 297 | weak_ptr_factory_.GetWeakPtr())); |
| 298 | } |
| 299 | |
| 300 | void SpeculativeReportQueueImpl::AttachActualQueue( |
Ahmed Nasr | f21e843 | 2022-07-30 00:48:37 | [diff] [blame] | 301 | StatusOr<std::unique_ptr<ReportQueue>> status_or_actual_queue) { |
Leonid Baraz | b8c27535 | 2021-08-05 00:59:09 | [diff] [blame] | 302 | sequenced_task_runner_->PostTask( |
| 303 | FROM_HERE, |
| 304 | base::BindOnce( |
| 305 | [](base::WeakPtr<SpeculativeReportQueueImpl> self, |
Ahmed Nasr | f21e843 | 2022-07-30 00:48:37 | [diff] [blame] | 306 | StatusOr<std::unique_ptr<ReportQueue>> status_or_actual_queue) { |
Leonid Baraz | b8c27535 | 2021-08-05 00:59:09 | [diff] [blame] | 307 | if (!self) { |
| 308 | return; |
| 309 | } |
| 310 | DCHECK_CALLED_ON_VALID_SEQUENCE(self->sequence_checker_); |
Ahmed Nasr | f21e843 | 2022-07-30 00:48:37 | [diff] [blame] | 311 | if (self->status_or_report_queue_.has_value()) { |
Leonid Baraz | b8c27535 | 2021-08-05 00:59:09 | [diff] [blame] | 312 | // Already attached, do nothing. |
| 313 | return; |
| 314 | } |
Ahmed Nasr | f21e843 | 2022-07-30 00:48:37 | [diff] [blame] | 315 | self->status_or_report_queue_ = std::move(status_or_actual_queue); |
| 316 | // TODO(b/239583016): remove the ok status check once the enqueue |
| 317 | // callbacks are stored along with the records in a pending queue |
| 318 | // instead of only the records, and run the callbacks with the |
| 319 | // failure status if creation failed. |
| 320 | if (self->status_or_report_queue_->ok() && |
| 321 | !self->pending_record_producers_.empty()) { |
Leonid Baraz | 8e2830e | 2022-06-02 20:26:50 | [diff] [blame] | 322 | self->EnqueuePendingRecordProducers( |
Leonid Baraz | b8c27535 | 2021-08-05 00:59:09 | [diff] [blame] | 323 | base::BindOnce([](Status enqueue_status) { |
| 324 | if (!enqueue_status.ok()) { |
| 325 | LOG(ERROR) << "Pending records failed to enqueue, status=" |
| 326 | << enqueue_status; |
| 327 | } |
| 328 | })); |
| 329 | } |
| 330 | }, |
Ahmed Nasr | f21e843 | 2022-07-30 00:48:37 | [diff] [blame] | 331 | weak_ptr_factory_.GetWeakPtr(), std::move(status_or_actual_queue))); |
Leonid Baraz | b8c27535 | 2021-08-05 00:59:09 | [diff] [blame] | 332 | } |
| 333 | |
Leonid Baraz | 61437cb | 2021-02-26 20:43:06 | [diff] [blame] | 334 | } // namespace reporting |