wai-rate-limit-postgres 0.1.0.0 → 0.2.0.0
raw patch · 4 files changed
+14/−5 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +8/−0
- src/Network/Wai/RateLimit/Postgres.hs +3/−2
- test/Spec.hs +1/−1
- wai-rate-limit-postgres.cabal +2/−2
CHANGELOG.md view
@@ -3,6 +3,14 @@ `wai-rate-limit-postgres` uses [PVP Versioning][1]. The changelog is available [on GitHub][2]. +## 0.2.0.0++* Fix bug in table name reference (#1)++## 0.1.0.0++Initial release+ ## 0.0.0.0 * Initially created.
src/Network/Wai/RateLimit/Postgres.hs view
@@ -100,10 +100,11 @@ " " [ "INSERT INTO", tableName,+ "as rl", "(key, usage) VALUES (?, ?)", "ON CONFLICT (key) DO UPDATE SET",- "usage = CASE WHEN rate_limiter.expires_at > CURRENT_TIMESTAMP THEN rate_limiter.usage + EXCLUDED.usage ELSE EXCLUDED.usage END,",- "expires_at = CASE WHEN rate_limiter.expires_at > CURRENT_TIMESTAMP THEN rate_limiter.expires_at ELSE CURRENT_TIMESTAMP + '1 week'::INTERVAL END",+ "usage = CASE WHEN rl.expires_at > CURRENT_TIMESTAMP THEN rl.usage + EXCLUDED.usage ELSE EXCLUDED.usage END,",+ "expires_at = CASE WHEN rl.expires_at > CURRENT_TIMESTAMP THEN rl.expires_at ELSE CURRENT_TIMESTAMP + '1 week'::INTERVAL END", "RETURNING usage" ]
test/Spec.hs view
@@ -37,7 +37,7 @@ mkTestWaiApp :: Integer -> Integer -> ByteString -> IO Wai.Application mkTestWaiApp seconds limit key = do pool <- mkConnPool- pgBackend <- postgresBackend pool "rate_limiter"+ pgBackend <- postgresBackend pool "rate_limiter_1" let app _ respond = respond $ Wai.responseLBS status200 [] "Ok!" strategy = R.fixedWindow pgBackend seconds limit (const $ return key) middleware = R.rateLimiting strategy
wai-rate-limit-postgres.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: wai-rate-limit-postgres-version: 0.1.0.0+version: 0.2.0.0 category: Security, Web, Network synopsis: See README for more info description:@@ -23,7 +23,7 @@ location: https://github.com/donatello/wai-rate-limit-postgres.git common common-options- build-depends: base >= 4.14.3.0 && < 4.16+ build-depends: base >= 4.12 && < 5 , relude ^>= 1.0 , wai-rate-limit ^>= 0.1.0.0 , postgresql-simple ^>= 0.6