diff options
author | Casey Bodley <cbodley@redhat.com> | 2024-08-15 19:58:30 +0200 |
---|---|---|
committer | Casey Bodley <cbodley@redhat.com> | 2024-08-15 20:04:49 +0200 |
commit | dee230c26d4fe894cb0d700e85cee37cd5c00a6c (patch) | |
tree | 1c2af244712c0f017e2d295d1f2eeed3be35e910 /src/rgw | |
parent | Merge pull request #59220 from ivoalmeida/carbon-datatable-cleanups (diff) | |
download | ceph-dee230c26d4fe894cb0d700e85cee37cd5c00a6c.tar.xz ceph-dee230c26d4fe894cb0d700e85cee37cd5c00a6c.zip |
rgw/notify: process_queue() constructs wait tokens when spawning
process_queue() spawns several coroutines, then waits on a tokens_waiter
until all of them complete
but spawned coroutines don't start immediately. if we call
waiter.async_wait() before any of the coroutine functions get spawned,
it will find `pending_tokens == 0` and return immediately
instead of constructing each token inside the spawned coroutine
function, construct them outside of spawn and capture them in the lambda
to extend their lifetime until the coroutine's completion
Signed-off-by: Casey Bodley <cbodley@redhat.com>
Diffstat (limited to 'src/rgw')
-rw-r--r-- | src/rgw/driver/rados/rgw_notify.cc | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/rgw/driver/rados/rgw_notify.cc b/src/rgw/driver/rados/rgw_notify.cc index 6b1dd9651f0..3f576120a8c 100644 --- a/src/rgw/driver/rados/rgw_notify.cc +++ b/src/rgw/driver/rados/rgw_notify.cc @@ -472,11 +472,10 @@ private: entries_persistency_tracker& notifs_persistency_tracker = topics_persistency_tracker[queue_name]; boost::asio::spawn(yield, std::allocator_arg, make_stack_allocator(), [this, ¬ifs_persistency_tracker, &queue_name, entry_idx, - total_entries, &end_marker, &remove_entries, &has_error, &waiter, - &entry, &needs_migration_vector, + total_entries, &end_marker, &remove_entries, &has_error, + token = waiter.make_token(), &entry, &needs_migration_vector, push_endpoint = push_endpoint.get(), &topic_info](boost::asio::yield_context yield) { - const auto token = waiter.make_token(); auto& persistency_tracker = notifs_persistency_tracker[entry.marker]; auto result = process_entry(this->get_cct()->_conf, persistency_tracker, |