Repository navigation
Generated session config: explain store and adapter, expire sessions after two weeks - #52
Merged
Merged
Conversation
…after two weeks New apps set session.expires to 1209600 (two weeks after the last change) instead of 0, and the session block explains what signed_cookie, encrypted_cookie and adapter keep where. The comments describe store: adapter, which Amber accepts from amberframework/amber#18 onward; the generated value stays signed_cookie.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes in a new app
The
sessionblock in every generatedconfig/environments/*.yml:expiresgoes from0to two weeks. With0, server-side sessions were never freed: the Amber benchmark lab measured the generated Pet Tracker growing from 12.7 MiB to 150 MiB in five minutes of cookie-free traffic on a 512 MB droplet until it was OOM-killed.Updated in both places that produce these files:
NewCommand#environment_config(the live path) andtemplates/app/config/environments/*.yml.ecr.Depends on
crimson-knight/amber#18, which makes Amber honor
session.store(sosigned_cookiereally keeps sessions in the cookie), addsstore: adapter, and caps the memory adapter at 10,000 sessions. The commit message names it as amberframework/amber#18; the correct link is crimson-knight/amber#18. The generated value (signed_cookie) works on the current Amber release either way;store: adapteris accepted once a release contains #18.Verification
crystal-alpha spec spec/commands/new_command_spec.cr: 168 examples, 0 failures. The#executespec now assertsstore: signed_cookieandexpires: 1209600in the generated development and test files (production.yml is encrypted at generation).