oncall-engine/engine/common
Matias Bordese 1a8e4fef40
Update OrderedModel.swap to retry on IntegrityError (#3940)
Related to https://github.com/grafana/oncall-private/issues/2386.

Issue seems related to [multiple concurrent Terraform-triggered
updates](https://ops.grafana-ops.net/explore?schemaVersion=1&panes=%7B%22j0s%22:%7B%22datasource%22:%22000000193%22,%22queries%22:%5B%7B%22refId%22:%22B%22,%22expr%22:%22%7Bcluster%3D%5C%22prod-eu-west-0%5C%22,%20namespace%3D%5C%22amixr-prod%5C%22%7D%20%7C%3D%20%5C%22logger%3Dinsight_logger%20tenant_id%3D735393%5C%22%20%7C%3D%20%5C%22resource_type%3Droute%5C%22%22,%22queryType%22:%22range%22,%22datasource%22:%7B%22type%22:%22loki%22,%22uid%22:%22000000193%22%7D,%22editorMode%22:%22code%22%7D%5D,%22range%22:%7B%22from%22:%221707813893526%22,%22to%22:%221707815856774%22%7D%7D%7D&orgId=1
) changing the route order to zero (and eventually succeeding)

Sample test run with the failing error:
```
========================================== short test summary info ===========================================
FAILED common/tests/test_ordered_model.py::test_ordered_model_swap_all_to_zero - assert not [DoesNotExist(), IntegrityError(1062, "Duplicate entry 'test-0' for key 'base_testorderedmodel...
======================================= 1 failed, 5 warnings in 34.39s =======================================
make: *** [Makefile:283: run-backend-test] Error 1
```
2024-02-22 20:51:05 +00:00
..
api_helpers Remove unused const 2024-01-24 16:32:58 +08:00
cloud_auth_api update request body to Cloud Auth API POST /v1/sign API call (#3838) 2024-02-05 14:56:48 -05:00
constants remove all references to deprecated AlertGroup.is_restricted field (#3228) 2023-10-31 20:10:45 +00:00
custom_celery_tasks fix infinitely retrying apps.alerts.tasks.notify_user.perform_notification task (#3708) 2024-01-18 07:07:01 -05:00
exceptions Send demo alert with dynamic payload and get demo payload example on private api (#1700) 2023-04-18 02:48:11 +00:00
insight_log Enable flake8-bugbear, fix issues (#3454) 2023-11-29 15:04:48 +00:00
jinja_templater Add parse_json template function (#3929) 2024-02-20 10:29:03 -05:00
migrations Add instruction on removing nullable fields from Django models (#2659) 2023-08-08 12:46:18 +00:00
oncall_gateway Handle 400 status codes from Chatops Proxy (#3886) 2024-02-13 14:36:49 +08:00
ordered_model Update OrderedModel.swap to retry on IntegrityError (#3940) 2024-02-22 20:51:05 +00:00
recaptcha Add validation of hostname for recapctha (#1445) 2023-03-06 08:59:48 +00:00
tests Update OrderedModel.swap to retry on IntegrityError (#3940) 2024-02-22 20:51:05 +00:00
__init__.py World, meet OnCall! 2022-06-03 08:09:47 -06:00
cache.py patch redis cluster multi-key operations (#3496) 2023-12-04 13:08:57 -05:00
database.py Fix Grafana teams sync (#1652) 2023-03-28 18:26:24 +00:00
l10n.py add user locale field to mobile app user settings table + change going on call push notification text (#2131) 2023-06-14 12:19:58 -04:00
public_primary_keys.py Re-enable a few mypy rules + fix existing errors (#2725) 2023-08-03 09:43:03 +00:00
timezones.py shift swap requests model + CRUD endpoints (#2597) 2023-07-21 19:35:19 +00:00
utils.py Don't html escape quotes when rendering (#3884) 2024-02-12 21:10:22 +00:00