Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

[PATCH] 2.3.2 need a way to check if a session exists without creating one

#2703

there doesn't seem to be a way to check if a session already exists without lazy-loading a new session.

Reported by trevor · May 24th, 2009 @ 03:23 AM

State: resolved
Milestone: none
Assigned to: josh josh
Importance: Medium

Activity

  1. Johan Sørensen
    Johan Sørensen
    • Title changed from 2.3.2 need a way to check if a session exists without creating one to [PATCH] 2.3.2 need a way to check if a session exists without creating one
    • Tag set to cookies, session

    I couldn't agree more. Attached is a patch series that only writes to the session store if the SessionHash setter was accessed.

    As a bonus, there's also a patch for not saving to the session when the flash content is empty.

    The upside of both of these is that it's not setting any cookies (eg. user not logged in etc), which makes things quite easier for edge-proxies

    May 27th, 2009 @ 02:27 PM

  2. Johan Sørensen
  3. josh
    josh
    • Milestone cleared.
    • State changed from new to open
    • Assigned user set to josh

    May 28th, 2009 @ 03:11 PM

  4. Repository
    Repository
    • State changed from open to resolved

    (from [dc94c095031036ffc0f9ac0ee98a1162e57062eb]) The FlashHash and friends causes a lot of needless session storing, when we know for a fact that there's no content in the flash. By not storing the empty hash in the session we save a lot of communication with the various session backends, while still keeping the same interface to the flash. [#2703 [PATCH] 2.3.2 need a way to check if a session exists without creating one state:resolved]

    Signed-off-by: Joshua Peek josh@joshpeek.com
    http://github.com/rails/rails/commit/dc94c095031036ffc0f9ac0ee98a11...

    May 28th, 2009 @ 03:35 PM

  5. Repository
  6. Repository
    Repository

    (from [72cb6f58be6590ac2590eea420a1b3ef175189b3]) The FlashHash and friends causes a lot of needless session storing, when we know for a fact that there's no content in the flash. By not storing the empty hash in the session we save a lot of communication with the various session backends, while still keeping the same interface to the flash. [#2703 [PATCH] 2.3.2 need a way to check if a session exists without creating one state:resolved]

    Signed-off-by: Joshua Peek josh@joshpeek.com
    http://github.com/rails/rails/commit/72cb6f58be6590ac2590eea420a1b3...

    May 28th, 2009 @ 03:35 PM

  7. Repository
  8. Sam Ruby
    Sam Ruby

    There is a problem. If the session contains any sort of mutable object, and that object is retrieved using the SessionHash getter and then updated, then the session is not guaranteed to be stored.

    https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets...

    I'd like to request that the change be backed out and this ticket reopened.

    May 30th, 2009 @ 04:12 AM

  9. Johan Sørensen
    Johan Sørensen

    facepalm

    That's quite a gaping hole indeed, I suggest reverting the commits as well until I (or someone else) come up with a better patch.

    May 30th, 2009 @ 11:29 AM

  10. Repository
    Repository

    (from [c73cf7d2c0d164d819a483c83302cd4a62ca24b9]) Revert "Only save the session if we're actually writing to it [#2703 [PATCH] 2.3.2 need a way to check if a session exists without creating one state:resolved]"

    This reverts commit 14edaa104de7b71a4cd11b03121c911ce221b813.
    http://github.com/rails/rails/commit/c73cf7d2c0d164d819a483c83302cd...

    May 30th, 2009 @ 03:36 PM

  11. Repository
    Repository

    (from [a1140a10318a79b5dace11679f654c33f477ef57]) Revert "Only save the session if we're actually writing to it [#2703 [PATCH] 2.3.2 need a way to check if a session exists without creating one state:resolved]"

    This reverts commit dd98280e38d640f5724887cf8a715b79f0439d2d.
    http://github.com/rails/rails/commit/a1140a10318a79b5dace11679f654c...

    May 30th, 2009 @ 03:37 PM