Skip to content

Commit cc361ed

Browse files
authored
Don't log exceptions on instance protection (#12568)
1 parent bd234fc commit cc361ed

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

readthedocs/projects/tasks/utils.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44

55
import boto3
66
import structlog
7+
from botocore.exceptions import ClientError
78
from celery.worker.request import Request
89
from django.conf import settings
10+
from django.core.exceptions import ValidationError
911
from django.db.models import Q
1012
from django.utils import timezone
1113

@@ -222,8 +224,12 @@ def set_builder_scale_in_protection(builder, protected_from_scale_in, build_id=N
222224
AutoScalingGroupName=scaling_group,
223225
ProtectedFromScaleIn=protected_from_scale_in,
224226
)
227+
except (ValidationError, ClientError):
228+
# Don't log these as exceptions,
229+
# since there isn't much we can do about it here.
230+
log.info("Failed when trying to set instance protection.")
225231
except Exception:
226-
log.exception("Failed when trying to set instance protection.")
232+
log.exception("Unexpected error when trying to set instance protection.")
227233

228234

229235
class BuildRequest(Request):

0 commit comments

Comments
 (0)