Question 380 of 1,000
mediumMultiple ChoiceObjective-mapped

How to Avoid Pub/Sub Message Redelivery with Long-Running Cloud Functions

This ACE practice question tests your understanding of ace exam topics. Read the scenario carefully and evaluate each option against the stated constraints before committing to an answer. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.

A Cloud Function (gen2) is triggered by Pub/Sub messages. The function processes each message by calling three external APIs sequentially. The total processing time is 25 seconds per message. The Pub/Sub subscription's ack deadline is 10 seconds. What will happen, and how should you fix it?

Quick Answer

The fix is to increase the Pub/Sub subscription’s ack deadline to exceed 25 seconds, because the Cloud Function’s total processing time outruns the default 10-second window, causing Pub/Sub to redeliver the message before the function can acknowledge it. This happens because the ack deadline is the maximum time Pub/Sub waits for an acknowledgment; if the function takes longer, the message is considered unacknowledged and re-sent, leading to duplicate processing. On the Google Associate Cloud Engineer exam, this scenario tests your understanding of Pub/Sub’s delivery guarantees and the need to align ack deadlines with actual processing time—a common trap is assuming Cloud Functions auto-extend the deadline, but gen2 functions do not modify the subscription’s ack deadline automatically. Remember the memory tip: “Ack deadline must exceed your longest API chain,” so if your function calls three external APIs sequentially for 25 seconds, set the deadline to at least 30 seconds to avoid redelivery.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

Messages will be redelivered before processing completes; extend the Pub/Sub subscription ack deadline to exceed 25 seconds.

The Pub/Sub subscription has a 10-second ack deadline, but the Cloud Function takes 25 seconds to process each message. Since the function does not acknowledge the message within the deadline, Pub/Sub considers the message unacknowledged and redelivers it, causing duplicate processing. The fix is to increase the ack deadline to exceed 25 seconds, ensuring the function has enough time to complete processing and send an acknowledgment.

Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Pub/Sub will wait indefinitely for the function to acknowledge; no issue occurs.

    Why it's wrong here

    Pub/Sub does not wait indefinitely. After the ack deadline expires, the message is redelivered to another subscriber — causing duplicate processing.

  • Messages will be redelivered before processing completes; extend the Pub/Sub subscription ack deadline to exceed 25 seconds.

    Why this is correct

    The ack deadline must be longer than the function processing time. Extending it to 30–60 seconds prevents premature redelivery. The minimum ack deadline is 10 seconds, maximum is 600 seconds on a subscription.

    Related concept

    Read the scenario before looking for a memorised answer.

  • The Cloud Function will automatically extend its own ack deadline via the Pub/Sub client library.

    Why it's wrong here

    Cloud Functions triggered via Pub/Sub push subscriptions cannot extend ack deadlines — ack extension is a pull subscriber feature. Push functions must complete within the ack deadline.

  • Increase the Cloud Function's memory to process faster and complete within 10 seconds.

    Why it's wrong here

    The bottleneck is external API latency (sequential calls), not function memory. Increasing memory won't reduce external API call time.

Common exam traps

Common exam trap: answer the scenario, not the keyword

The trap here is that candidates assume Cloud Functions automatically handle Pub/Sub ack deadlines or that increasing resources speeds up I/O-bound operations, but the exam tests understanding of the explicit ack deadline configuration and the need to match it to processing time.

Detailed technical explanation

How to think about this question

Under the hood, Pub/Sub uses a lease-based mechanism where the subscriber must extend the ack deadline via the `modifyAckDeadline` method if more time is needed. In Cloud Functions, the runtime environment does not automatically call this method; the function must explicitly handle ack deadline extension in its code. A real-world scenario is when a function calls multiple slow external APIs; without extending the ack deadline, messages are redelivered, leading to duplicate work and potential data inconsistency.

KKey Concepts to Remember

  • Read the scenario before looking for a memorised answer.
  • Find the constraint that changes the correct option.
  • Eliminate answers that are true in general but not in this case.

TExam Day Tips

  • Watch for words such as best, first, most likely and least administrative effort.
  • Review why wrong options are wrong, not only why the correct option is correct.

Key takeaway

Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Real-world example

How this comes up in practice

A cloud solutions architect for a retail company is evaluating services for a new workload. The correct answer here reflects best practice for the specific scenario described — not a general cloud recommendation. Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option. Cloud exam questions reward reading the constraint carefully: the same technology can be right or wrong depending on the use case.

Related practice questions

Related ACE practice-question pages

Use these pages to review the topic behind this question. This is how one missed question becomes focused revision.

Practice this exam

Start a free ACE practice session

Short sessions build daily habit. Longer sessions build exam-day stamina. Try a timed session to simulate real conditions.

FAQ

Questions learners often ask

What does this ACE question test?

Read the scenario before looking for a memorised answer.

What is the correct answer to this question?

The correct answer is: Messages will be redelivered before processing completes; extend the Pub/Sub subscription ack deadline to exceed 25 seconds. — The Pub/Sub subscription has a 10-second ack deadline, but the Cloud Function takes 25 seconds to process each message. Since the function does not acknowledge the message within the deadline, Pub/Sub considers the message unacknowledged and redelivers it, causing duplicate processing. The fix is to increase the ack deadline to exceed 25 seconds, ensuring the function has enough time to complete processing and send an acknowledgment.

What should I do if I get this ACE question wrong?

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

What is the key concept behind this question?

Read the scenario before looking for a memorised answer.

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Keep practising

More ACE practice questions

Last reviewed: Jun 11, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

This ACE practice question is part of Courseiva's free Google Cloud certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the ACE exam.