Skip to content

Don't send bot requests if cancelCall is already set

Jeremiah Bonney requested to merge jbonney/fix-cancel-before-call into master

Before raising this MR, consider whether the following are required, and complete if so:

  • Unit tests
  • Metrics - NA
  • Documentation update(s) - NA

Description

This PR updates the updateBotSession and createBotSession methods in BotSessionUtils to check cancelCall before sending their respective requests and returning CANCELLED right away if already set. This can happen if the worker is signaled while not currently processing a request, such as when it's actively working on a lease or the bot was previously in status UNHEALTHY.

The code as is will send a request and then immediately cancel it, which is pretty silly. In addition the worker will send a follow up request right away, which I've seen cause errors like the following from BuildGrid:

 An active RPC for work is in-progress for BotName=[dev/a37a1125-3b38-420c-b4c3-a9acbaa7d451]

Merge request reports