| Index: appengine/swarming/server/lease_management.py
|
| diff --git a/appengine/swarming/server/lease_management.py b/appengine/swarming/server/lease_management.py
|
| index 6b6e98ad62025aa7c96a7483189cade6303672d8..80c1c8facf34acbdd362cde7f8030c2a498b3d4d 100644
|
| --- a/appengine/swarming/server/lease_management.py
|
| +++ b/appengine/swarming/server/lease_management.py
|
| @@ -906,13 +906,8 @@ def check_for_connection(machine_lease):
|
| # The bot hasn't connected yet. If it's dead or missing, release the lease.
|
| # At this point we have sent the connection instruction so the bot could still
|
| # connect after we release the lease but before Machine Provider actually
|
| - # deletes the bot. Therefore we also schedule a termination task. If the bot
|
| - # connects, it will just shut itself down immediately.
|
| - task_scheduler.schedule_request(
|
| - task_request.create_termination_task(machine_lease.hostname, True),
|
| - None,
|
| - check_acls=False,
|
| - )
|
| + # deletes the bot. Therefore we also schedule a termination task if releasing
|
| + # the bot. That way, if the bot connects, it will just shut itself down.
|
| bot_info = bot_management.get_info_key(machine_lease.hostname).get()
|
| if not bot_info:
|
| logging.error(
|
| @@ -920,6 +915,11 @@ def check_for_connection(machine_lease):
|
| machine_lease.key,
|
| machine_lease.hostname,
|
| )
|
| + task_scheduler.schedule_request(
|
| + task_request.create_termination_task(machine_lease.hostname, True),
|
| + None,
|
| + check_acls=False,
|
| + )
|
| if release(machine_lease):
|
| clear_lease_request(machine_lease.key, machine_lease.client_request_id)
|
| return
|
| @@ -929,6 +929,11 @@ def check_for_connection(machine_lease):
|
| machine_lease.key,
|
| machine_lease.hostname,
|
| )
|
| + task_scheduler.schedule_request(
|
| + task_request.create_termination_task(machine_lease.hostname, True),
|
| + None,
|
| + check_acls=False,
|
| + )
|
| if release(machine_lease):
|
| cleanup_bot(machine_lease)
|
|
|
|
|