Skip to content

Commit dee230c

Browse files
committed
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 <[email protected]>
1 parent dbcd888 commit dee230c

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/rgw/driver/rados/rgw_notify.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -472,11 +472,10 @@ class Manager : public DoutPrefixProvider {
472472
entries_persistency_tracker& notifs_persistency_tracker = topics_persistency_tracker[queue_name];
473473
boost::asio::spawn(yield, std::allocator_arg, make_stack_allocator(),
474474
[this, &notifs_persistency_tracker, &queue_name, entry_idx,
475-
total_entries, &end_marker, &remove_entries, &has_error, &waiter,
476-
&entry, &needs_migration_vector,
475+
total_entries, &end_marker, &remove_entries, &has_error,
476+
token = waiter.make_token(), &entry, &needs_migration_vector,
477477
push_endpoint = push_endpoint.get(),
478478
&topic_info](boost::asio::yield_context yield) {
479-
const auto token = waiter.make_token();
480479
auto& persistency_tracker = notifs_persistency_tracker[entry.marker];
481480
auto result =
482481
process_entry(this->get_cct()->_conf, persistency_tracker,

0 commit comments

Comments
 (0)