Skip to content

Commit

Permalink
fix(pubsub): missing subscription name in lease extensions
Browse files Browse the repository at this point in the history
When I changed the lease extensions to use unary RPCs (as opposed to
inline messages in the streaming pull), I neglected to include the
subscription name with the request.
  • Loading branch information
coryan committed Jul 19, 2022
1 parent 6d076fc commit 0c192ef
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ future<Status> StreamingSubscriptionBatchSource::BulkNack(
void StreamingSubscriptionBatchSource::ExtendLeases(
std::vector<std::string> ack_ids, std::chrono::seconds extension) {
google::pubsub::v1::ModifyAckDeadlineRequest request;
request.set_subscription(subscription_full_name_);
request.set_ack_deadline_seconds(
static_cast<std::int32_t>(extension.count()));
for (auto& a : ack_ids) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -522,17 +522,25 @@ TEST(StreamingSubscriptionBatchSourceTest, AckMany) {
Property(&ModifyRequest::ack_ids,
ElementsAre("fake-003"))))
.WillOnce(OnModify);
EXPECT_CALL(*mock, AsyncModifyAckDeadline(
_, _,
Property(&ModifyRequest::ack_ids,
ElementsAre("fake-004", "fake-005"))))
EXPECT_CALL(
*mock,
AsyncModifyAckDeadline(
_, _,
AllOf(
Property(&ModifyRequest::subscription,
"projects/test-project/subscriptions/test-subscription"),
Property(&ModifyRequest::ack_ids,
ElementsAre("fake-004", "fake-005")))))
.WillOnce(OnModify);
EXPECT_CALL(
*mock,
AsyncModifyAckDeadline(
_, _,
AllOf(Property(&ModifyRequest::ack_ids, ElementsAre("fake-006")),
Property(&ModifyRequest::ack_deadline_seconds, 123))))
AllOf(
Property(&ModifyRequest::subscription,
"projects/test-project/subscriptions/test-subscription"),
Property(&ModifyRequest::ack_ids, ElementsAre("fake-006")),
Property(&ModifyRequest::ack_deadline_seconds, 123))))
.WillOnce(OnModify);

auto shutdown = std::make_shared<SessionShutdownManager>();
Expand Down

0 comments on commit 0c192ef

Please sign in to comment.