title: PubSub acknowledge deadline
body: <p>I have a cloud function which publishes a message to PubSub and that triggers a cloud run to perform an archive file process. When there are large files, my cloud run python code takes some time to process the data it looks like PubSub is retrying the message after 20 seconds (default acknowledge deadline time) which is triggering another instance from my Cloud Run. I've increased the acknowledge deadline to 600s and redeployed everything but it's still retrying the message after 20 seconds. I am missing anything?</p>
  <p>Cloud Function publishing the message code:</p>
  <pre><code># Publishes a message
     try:
        publish_future = publisher.publish(topic_path, data=message_bytes)
        publish_future.result()  # Verify the publish succeeded
        return 'Message published.'
     except Exception as e:
        print(e)
        return (e, 500)
  </code></pre>
  <p>Here is the PubSub subscription config:
  <a href="https://i.stack.imgur.com/8legz.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8legz.jpg" alt="enter image description here" /></a></p>
  <p>Logging showing a second instance being triggered after 20s:
  <a href="https://i.stack.imgur.com/a9ONt.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/a9ONt.jpg" alt="enter image description here" /></a></p>
  <p>Cloud Run code:</p>
  <pre><code>@app.route(&quot;/&quot;, methods=[&quot;POST&quot;])
  def index():
      envelope = request.get_json()
      if not envelope:
          msg = &quot;no Pub/Sub message received&quot;
          print(f&quot;error: {msg}&quot;)
          return f&quot;Bad Request: {msg}&quot;, 400        
  
      if not isinstance(envelope, dict) or &quot;message&quot; not in envelope:
          msg = &quot;invalid Pub/Sub message format&quot;
          print(f&quot;error: {msg}&quot;)
          return f&quot;Bad Request: {msg}&quot;, 400
  
      pubsub_message = envelope[&quot;message&quot;]
  
      if isinstance(pubsub_message, dict) and &quot;data&quot; in pubsub_message:
          #Decode base64 event['data']
          event_data = base64.b64decode(pubsub_message['data']).decode('utf-8')
          message = json.loads(event_data)
  
          #logic to process data/archive
          return (&quot;&quot;, 204)
  
  
  
  </code></pre>