mapbox / Hecate

Fast Geospatial Feature Storage API
MIT License
252 stars 36 forks source link

Create/Delete/Update Webhooks with Read/Write db connection #187

Closed lizziegooding closed 4 years ago

lizziegooding commented 4 years ago

Context

Previously, the webhooks_create, webhooks_update, and webhooks_delete functions used DbReplica connections to access Postgres, meaning that, if there were replicas, they could try to write to a read-only replica, resulting in 500 errors for the user. The postgres error we saw was ERROR: cannot execute INSERT in a read-only transaction. Note that requests to these endpoints would sometimes succeed if the connection happen to be routed to the main database rather than a replica. I also changed two connections for get endpoints that were using DbReadWrite connections to DbReplica.

Next steps

cc/ @ingalls @miccolis @samely @mattciferri