[PATCH 0/4] Add 'Event.payload' field

Stephen Finucane stephen at that.guru
Mon Mar 26 02:17:27 AEDT 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.

Stephen Finucane (4):
  REST: Support embedded serializers without context
  signals: Only enable events when REST API enabled
  models: Migrate event fields to JSON field
  REST: Only fetch required fields event filtering

 patchwork/api/embedded.py                          |  60 ++++++++---
 patchwork/api/event.py                             | 110 +++++++++++++--------
 patchwork/api/filters.py                           |   7 ++
 patchwork/fields.py                                |  32 ++++++
 .../migrations/0025_add_event_payload_field.py     |  21 ++++
 ...26_migrate_data_from_event_fields_to_payload.py |  63 ++++++++++++
 .../migrations/0027_remove_old_event_fields.py     |  34 +++++++
 patchwork/models.py                                |  28 +-----
 patchwork/signals.py                               |  70 +++++++++++--
 patchwork/tests/test_events.py                     | 110 +++++++++++++--------
 .../events-require-rest-api-47eab4a3be745f75.yaml  |   5 +
 11 files changed, 413 insertions(+), 127 deletions(-)
 create mode 100644 patchwork/migrations/0025_add_event_payload_field.py
 create mode 100644 patchwork/migrations/0026_migrate_data_from_event_fields_to_payload.py
 create mode 100644 patchwork/migrations/0027_remove_old_event_fields.py
 create mode 100644 releasenotes/notes/events-require-rest-api-47eab4a3be745f75.yaml

-- 
2.14.3



More information about the Patchwork mailing list