[PATCH v2 0/6] Add 'Event.payload' field

Stephen Finucane stephen at that.guru
Tue Apr 10 07:02:50 AEST 2018


The '/event' API endpoint is really slow due to the amount of JOINs
necessary to retrieve records from the database. Resolve this by
a static JSON representation of any embedded data in the database. This
has some disadvantages, noted in the patches, but the performance
improvement is huge and users will not notice a thing.

As a necessary side-effect of this change, events now require the REST
API be enabled. To be honest, this should have been the case from day 1
as events are currently only exposed over this API.

Changes since v1:
- Use NumberFilter for event fields to prevent the generation of large
  <select>s
- Revert changes to use the JSON renderer for '/events' as this is now
  resolved
- Multiple bug fixes and other improvements

Stephen Finucane (6):
  REST: Support embedded serializers without context
  signals: Only enable events when REST API enabled
  tests: Add events API tests
  models: Migrate event fields to JSON field
  REST: Use NumberFilter for event fields
  Revert "api: Only provide JSON version of events list"

 patchwork/api/embedded.py                          |  58 +++++--
 patchwork/api/event.py                             | 136 ++++++++--------
 patchwork/api/filters.py                           |   5 +
 patchwork/fields.py                                |  46 ++++++
 .../migrations/0026_add_event_payload_field.py     |  21 +++
 ...27_migrate_data_from_event_fields_to_payload.py |  61 ++++++++
 .../migrations/0028_remove_old_event_fields.py     |  34 ++++
 patchwork/models.py                                |  28 +---
 patchwork/signals.py                               |  80 ++++++++--
 patchwork/templates/patchwork/event-list.html      |  17 --
 patchwork/tests/api/test_event.py                  | 173 +++++++++++++++++++++
 patchwork/tests/test_events.py                     | 110 ++++++++-----
 .../events-require-rest-api-47eab4a3be745f75.yaml  |   5 +
 13 files changed, 598 insertions(+), 176 deletions(-)
 create mode 100644 patchwork/migrations/0026_add_event_payload_field.py
 create mode 100644 patchwork/migrations/0027_migrate_data_from_event_fields_to_payload.py
 create mode 100644 patchwork/migrations/0028_remove_old_event_fields.py
 delete mode 100644 patchwork/templates/patchwork/event-list.html
 create mode 100644 patchwork/tests/api/test_event.py
 create mode 100644 releasenotes/notes/events-require-rest-api-47eab4a3be745f75.yaml

-- 
2.14.3



More information about the Patchwork mailing list