Commit graph

19 commits

Author SHA1 Message Date
Gavin M. Roy
661a5986c7 Attempt to fix the reconnection race condition
1. Add new property function in the ApplicationMixin to indicate if Postgres is connected
2. Add a new guard in the RequestHandlerMixin to check that Postgres is connected prior to executing a query, raising a 503 if it is not
3. Catch OperationalError in RequestHandlerMixin and return 503 for it
4. Timeout when waiting on the connection when attempting to reconnect
5. Log when we're creating a new pool
6. Add debug logging to trace when connectios open
7. Add tests that ensure reconnect logic works as expected
2021-04-14 15:59:13 -04:00
Gavin M. Roy
d0740754c9
Revert the version bump 2021-01-20 16:53:26 -05:00
Gavin M. Roy
57c41365f1
Bump the version 2021-01-20 16:51:25 -05:00
Gavin M. Roy
16b12cf470 Explicitly raise a FK error 2021-01-11 22:31:54 -05:00
Gavin M. Roy
3d6345a882 Missed some abstractions from envvars in 1.6 2021-01-08 18:14:39 -05:00
Gavin M. Roy
ca362e2bc5 Allow for settings based configuration 2021-01-08 14:55:25 -05:00
Gavin M. Roy
e2e80eea2f Add tornado-problem-details support 2020-09-16 19:57:01 -04:00
Brian Korty
4bbcf51132 Bump version to 1.4.1
Bump the release version to 1.4.1
2020-09-01 10:57:50 -04:00
Gavin M. Roy
ce6e2ecee7 Bump the version for the next release 2020-08-11 19:41:31 -04:00
Kevin Vance
1e7279916c Bump version to 1.3.3 2020-07-30 15:09:55 -04:00
Gavin M. Roy
4f60c7bf0a Delay the initialization of asyncio objects to on_start 2020-07-08 14:33:04 -04:00
Gavin M. Roy
70cf5c005b Show the actual URL that is being connected to 2020-07-07 18:37:06 -04:00
Gavin M. Roy
ecc070e974 Add reconfiguration for SRV based connections
- Attempt to add graceful reconfiguration for SRV based connections. On connection failure, the pool will be closed and reopened after fetching to get new SRV records.
- When using SRV, use all return hosts in the PostgreSQL URL
- If multiple requests hit a disconnect error, the reconnect logic will allow the first one in to reconnect and the others to wait
2020-07-07 16:17:56 -04:00
Gavin M. Roy
3e36210c91 Add support for SRV based configuration
Supports both postgresql+srv and aws+srv where aws+srv supports the ECS service discovery Route53 SRV record lookup behavior.
2020-06-02 11:26:07 -04:00
Gavin M. Roy
10b98cba10 Change sprockets_postgres.QueryResult to a class
After use in a couple APIs, I found having to check against QueryResult.row and QueryResult.rows too difficult, so this change will always have content in QueryResult.rows, even if it's one row.

In addition, it turns the object into an iterator and adds __repr__ and __len__ magic methods to make interacting with it easier
2020-04-27 18:16:18 -04:00
Gavin M. Roy
86b6c022f0 Update DEFAULT_POSTGRES_MAX_POOL_SIZE
Even though ``0`` is documented as the max pool size in the aiopg docs, setting it to 0 causes an exception in `aiopg.pool.Pool._fill_free_pool`:

```
  File "/Users/gavinr/Source/PSE/anabroker/env/lib/python3.7/site-packages/aiopg/pool.py", line 208, in _fill_free_pool
    if override_min and self.size < self.maxsize:
TypeError: '<' not supported between instances of 'int' and 'NoneType'
```

Set to the same default as aiopg, @ 10.
2020-04-13 14:20:09 -04:00
Gavin M. Roy
58100b3a54 pymodules -> py_modules, fix packaging 2020-04-10 16:26:18 -04:00
Gavin M. Roy
a7b15254f4 Bump the version 2020-04-08 18:48:10 -04:00
Gavin M. Roy
ca5dc26de3 Move from a package to a module 2020-04-06 17:47:50 -04:00