Commit Graph

125 Commits

Author SHA1 Message Date
Michael Xavier
adda409f90 Merge remote-tracking branch 'upstream/master' into redis-session-expiry 2017-01-25 17:46:29 -08:00
Michael Xavier
b51d32df4d widen deps 2016-11-28 09:30:29 -08:00
Michael Snoyman
c2c1718f11 Merge pull request #9 from k-bx/patch-1
Bump hedis
2016-09-22 16:17:23 +03:00
Kostiantyn Rybnikov
3f5b0da2f1 Re-bump hedis 2016-09-22 14:01:10 +03:00
Kostiantyn Rybnikov
7bce4c18e7 Bump hedis
Useful for https://github.com/fpco/stackage/issues/1247
2016-03-24 17:28:34 +02:00
Michael Xavier
d135958be5 Update comments, exercise expiration codepath
I wanted to at least ensure my change's code was excerised, even though
it makes no material difference to the allStorageTests suite.
2016-03-12 13:11:43 -08:00
Michael Xavier
7d922d1de4 Add first stab at backend auto expiry
This is for issue #7

So it would be nice if we had access to `State` because it would provide
us with `cookieExpires`, but nothing in the machinery of serversession
makes it available to backends for some reason. Also the tests seem to
indicate that the State may not be available at the time of setting up
storange engines (or may be a chicken-and-egg situation). The best
solution seemed to be to take the settings for absolute and idle timeout
that you're going to give to the state and share them.

Just as a reminder for the motivation on this: currently in
serversession's redis backend, you accumulate sessions
indefinitely. Even after they expire, they will stay in redis. The other
backends seem vulnerable to this too but its probably not nearly a big
deal in something like persistent because:

1. Storage is not as much of a premium in peristent's supported backend
compared to redis. They are primarily storing to disk.
2. Persistent's backends have good querying primitives so it is simple
to write jobs to delete old sessions.

Redis must fit all data in memory, so storage is at a premium and in
order to find old keys you'd have to issue the frowned-upon KEYS
command (or SCAN which isn't even suppored by hedis yet) and parse every
session.

This change uses redis' built in expiry mechanism and sets the
expiration every time a write operation is made to a session. Sessions
as they would naturally expire on the client side will now automatically
expire and free memory on the backend.
2016-03-11 16:54:14 -08:00
Felipe Lessa
cc69e23dc9 serversession-backend-redis-1.0.1 2015-12-31 15:45:45 -02:00
Felipe Lessa
c334f3bd07 serversession-backend-persistent-1.0.2 2015-12-31 15:45:16 -02:00
Felipe Lessa
01b277b11e New .travis.yml using stack instead of cabal-meta. 2015-12-31 15:25:41 -02:00
Felipe Lessa
9d0ee44c06 serversession-backend-acid-state-1.0.3 2015-12-31 11:26:45 -02:00
Felipe Lessa
50c29148ab Make serversession-backend-acid-state work with older versions. 2015-12-31 11:26:25 -02:00
Felipe Lessa
e7a4de11f8 Fix serversession-example-yesod-persistent, add to stack.yaml. 2015-12-31 11:26:07 -02:00
Felipe Lessa
7433a914ce Merge pull request #6 from DanBurton/master
Upgrade to safecopy-0.9. yesodweb/serversession#5
2015-12-31 10:38:14 -02:00
Dan Burton
cfe7118e50 Upgrade to safecopy-0.9. yesodweb/serversession#5 2015-12-30 14:26:20 -08:00
Felipe Lessa
c528a671d4 Accept acid-state 0.13 and beyond (fixes #4). 2015-09-03 15:13:18 -03:00
Felipe Lessa
d882c65e6b Upgrade stack.yaml to latest versions. 2015-09-03 15:12:05 -03:00
Felipe Lessa
8f24238065 serversession-backend-persistent-1.0.1 2015-06-24 11:14:32 -03:00
Felipe Lessa
7b9e83366b Allow persistent-2.2. 2015-06-24 11:14:11 -03:00
Felipe Lessa
203c94cf1e Give more leeway to Travis. 2015-06-16 17:28:45 -03:00
Felipe Lessa
64dc7f9228 serversession-backend-acid-state-1.0.1 2015-06-16 13:56:49 -03:00
Felipe Lessa
b21904d751 Use modify instead of modify' on acid-state backend.
Shouldn't make any difference in strictness due to the way acid-state
works, and should allow us to support older mtl versions.
2015-06-16 13:55:48 -03:00
Felipe Lessa
c5ab2571a4 serversession-1.0.1. 2015-06-16 13:40:53 -03:00
Felipe Lessa
c27597573d loadSession uses getCurrentTime, don't use fakenow (fixes #1). 2015-06-16 13:39:47 -03:00
Felipe Lessa
511dd91402 Working stack file.
Tested on stack-0.0.2.1.
2015-06-15 16:53:16 -03:00
Felipe Lessa
a6e2abd988 Prettier example routes.
[ci skip]
2015-06-01 15:27:56 -03:00
Felipe Lessa
66d858170e Add serversession code to Yesod+Persistent example.
Example doesn't showcase yesod-auth integration, though.
2015-06-01 14:36:15 -03:00
Felipe Lessa
da120b20ef Use qualified imports for persistent example section.
The scaffold namespace is too poluted.
2015-06-01 13:14:20 -03:00
Felipe Lessa
23584a9c47 Add new Yesod+Persistent example, currently just "yesod init".
Separating "yesod init" commit from others in order to be clearer what
changes were made to the scaffold.

[ci skip]
2015-06-01 13:01:23 -03:00
Felipe Lessa
1a1a281517 Travis: Skip 100 MiB SQL tests.
This is getting ridiculous.  The test that used to fail on GHC 7.10 and
work on GHC 7.8, now failed on GHC 7.8 and worked on GHC 7.10.

It's better to have a predictable test suite with two less unit tests
than having an unpredictable one.
2015-06-01 12:53:31 -03:00
Felipe Lessa
fefb86db47 Travis: Delete database files after running tests.
Currently PostgreSQL is dying on GHC 7.10 but not on GHC 7.8.

Hypothesis: The files left over from the acid-state local storage test
are consuming resources that PostgreSQL needs.  These files are not
created on GHC 7.8, only on GHC 7.10.
2015-06-01 11:25:03 -03:00
Felipe Lessa
056d47ee23 Now really fix it. 2015-06-01 03:59:57 -03:00
Felipe Lessa
1aeacdebea Fix acid-state test on GHC < 7.10. 2015-06-01 03:41:59 -03:00
Felipe Lessa
d291e72ba3 Add note about tests on README.md. 2015-06-01 03:32:33 -03:00
Felipe Lessa
5a7b4ce08f
Test GHC 7.10 via base package. 2015-06-01 03:15:31 -03:00
Felipe Lessa
9b1be63b8a Don't test AcidStorage on local storage if on GHC < 7.10.
I give up.  I hope the tests finally go green on Travis.
2015-06-01 02:49:00 -03:00
Felipe Lessa
e4f9f422d8 Travis: Don't bother with GHC HEAD. 2015-06-01 02:08:36 -03:00
Felipe Lessa
d23c5ac4c6 Use a HashMap on acid-state implementation + Travis.
Also dial back on maximum heap size as 2 GiB with -F1.5 still makes OOM
kill the process on Travis.
2015-06-01 02:06:36 -03:00
Felipe Lessa
9a471a90ea Travis: Tweak acid-state test suite RTS options again.
C'mon, GHC 7.8... Why do you need so much more memory than GHC 7.10?
2015-06-01 00:55:43 -03:00
Felipe Lessa
1b3bec4778 Travis: Allow a slightly bigger heap for acid-state test suite.
Although it uses 580M on my GHC 7.10, it blew up the 1 GiB limit on Travis.

Travis currently allows usage of 3 GiB, and GHC tends to use 2x the the
maximum residency (even with the compacting option, WTF?).
2015-05-31 23:50:53 -03:00
Felipe Lessa
774bc18fa1 Force the test suites to use a lot less memory.
Works fine on my machine using GHC 7.10 with these limits.  Note that
I've activated the in-place compaction GC.
2015-05-31 23:22:21 -03:00
Felipe Lessa
0cca9cd086 Use HashMap for SessionMap.
It's a bit faster and uses a bit less memory.
2015-05-31 23:09:02 -03:00
Felipe Lessa
e127371df6 Travis: Explicitly run each test suite.
Travis is timing out and I can't see where in the test suite we're
having problems.
2015-05-31 21:35:42 -03:00
Felipe Lessa
4ff73d87d8 Travis: Use PostgreSQL 9.3.
The persistent test is failing and I have no idea why, as it's not
displaying any error message.  This commit changes a few things with
PostgreSQL just to see if they make any difference.

Note that the persistent test suite passes with flying colors both
before and after this commit on my machine using PostgreSQL 9.4.2.
2015-05-31 16:30:44 -03:00
Felipe Lessa
fcdb14e2bf More GHC 7.8 fixes: Functor constraint. 2015-05-31 15:42:10 -03:00
Felipe Lessa
e9c4ea69a5 Travis: run tests sequentially.
They're too intensive and already make good use of the availabe CPU and RAM.
2015-05-31 15:14:46 -03:00
Felipe Lessa
1770734cdb More consistent badge style. 2015-05-31 15:05:17 -03:00
Felipe Lessa
8f719a3cbb Add Travis and Hackage badges to main README.md. 2015-05-31 15:02:44 -03:00
Felipe Lessa
4e3f27cb36 Setup.lhs x 7. 2015-05-31 14:56:39 -03:00
Felipe Lessa
d967f2b4a7 More GHC 7.8 fixes: DeriveDataTypeable, imports, (Functor m). 2015-05-31 14:53:26 -03:00